[OpenLayers-Users] Problems w/ sqlview and passing commas

Tito, Joseph Joseph.Tito at cobham.com
Mon Sep 12 15:36:50 EDT 2011


I've created the following sqlview and I'm trying to pass a comma
separated list of "1,2" to %event_types% from javascript

 

                SELECT `fid`, `title`, `description`, `lonlat`,
`event_type` FROM `events` WHERE `event_type` IN (%event_types%)

 

Here is the javascript I'm using to create my WMS layer:

 

                var events = new OpenLayers.Layer.WMS("Events",

                "http://geoserver.joetito.com:80/geoserver/wfs", 

                {

                                layers: 'events', 

                                transparent: true, 

                                format: 'image/gif',

                                viewparams: 'event_type:1,2' 

                }

                );

 

If I pass the string "event_type:1,2" or "event_type:1\,2", GeoServer
complains:

 

                1 layers requested, but found 2 view params specified

 

If I pass the strong "event_type:1\\,2", GeoServer doesn't return any
data. I looked at my GeoServer logs, and it seems that if I pass it this
way, it resolved to:

 

                VIEWPARAMS=event_type:1\,2

 

Has anyone else had problems passing CSV lists to sqlviews? If so, how
do I get around this?

 

Thanks

 

Joe Tito

Cyber Security Operation

SPARTA National Security Business Unit

Joseph.Tito at cobham.com

Tel: 443.430.8054

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110912/3aa574a2/attachment.html


More information about the Users mailing list