setExpression issue - matching strings as opposed to numbers?

Donal Regan donal_regan10 at YAHOO.CO.UK
Thu Sep 14 23:42:11 EDT 2006


Hello.

I am trying to use oClass->setExpression() and can only get it to work if the value I'm setting is a number as opposed to a string.

For example 

In my db I have an entry with 
id = 19;
session_id = 85488e93fe70fe0d52eee0f6a60662b0.

I'm trying to get this entry and style it.

$oClass->setExpression("([id] = 19)"); works

as does (if I edit the session_id to be '85488')

$oClass->setExpression("([session_id] = 85488");


When I try

$oClass->setExpression("([session_id] = 85488e93fe70fe0d52eee0f6a60662b0)");

or 

$oClass->setExpression("([session_id] = \"85488e93fe70fe0d52eee0f6a60662b0\")");

or

$oClass->setExpression("([session_id] = '85488e93fe70fe0d52eee0f6a60662b0')");


my shapes don't appear. It looks like there it doesn't like the letters in my string.

Any ideas?

My code and mapfile layer follow.

if (strcmp($oLayer->getMetaData ("temp_only"), "true" ) == 0){
                        $oClass = ms_newClassObj($oLayer);
                        $oClass->setExpression("([session_id] = 85488)");#Displays ok
                        #$oClass->setExpression("([id] = 19)");#Displays ok
                        $oStyle = ms_newStyleObj($oClass);
                        $oStyle->color->setRGB(0,0,0);
                        $oStyle->outlinecolor->setRGB(0,0,0);
                        $oLayer->set('status',MS_ON);
                    }
 

LAYER
   GROUP "TemporaryAddedPolygons" 
   NAME "TemporaryAddedPolygons"
   TYPE POLYGON
   STATUS OFF
   CONNECTIONTYPE postgis
   CONNECTION "user=xx dbname=xx host=xx"
   DATA "the_geom FROM (select type,id,oid,the_geom,session_id from added_shapes_temp)  as foo using unique oid using srid=4326"
   METADATA
    "opacity" "50"
    "temp_only" "true"
    "tile_source" "nocache"
   END
   CLASSITEM "session_id"
END

I'm a bit  lost and would appreciate any help.

Cheers.

Donal.





 		
---------------------------------
 Yahoo! Messenger - with free PC-PC calling and photo sharing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060915/20ae3df1/attachment.html


More information about the mapserver-users mailing list