layerdefinition and timestamp

478
5
03-15-2011 06:10 AM
ParksCamp
New Contributor III
Attempting to apply a layer definition through the flex api to an ArcGISDynamicMapLayer.  Target layer is on postgresql/SDE.  For some reason, I can use the "date" function successfully, but not the "timestamp" function.  Here's the code:

var wwaLyr:ArcGISDynamicMapServiceLayer = map.getLayer("WWA") as ArcGISDynamicMapServiceLayer;

var stringDef:String = "beginDate <= timestamp'2010-03-11 19:50:00'"; //This does not work
var stringDef:String = "beginDate <= date'2010-03-11'"; //This works

wwaLyr.layerDefinitions = [stringDef];
wwaLyr.refresh();


Any thoughts on why TIMESTAMP is not working.

Thanks,
Parks
Tallahassee
Tags (2)
0 Kudos
5 Replies
DasaPaddock
Esri Regular Contributor
What versions of ArcGIS Server and ArcGIS API for Flex are you using?
0 Kudos
ParksCamp
New Contributor III
What versions of ArcGIS Server and ArcGIS API for Flex are you using?


I'm using version 2.2 of the Flex API.  The service I'm consuming is running on ArcGIS Server 9.3.1.

Thanks,
Parks
0 Kudos
DasaPaddock
Esri Regular Contributor
You'll need to be using a ArcGIS Server 10 hosted service since it has added a new syntax for the layerDefs parameter that allows :'s in the definition value. The old syntax uses :'s as a layer id separator.

Reference:
http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/export.html
0 Kudos
ParksCamp
New Contributor III
You'll need to be using a ArcGIS Server 10 hosted service since it has added a new syntax for the layerDefs parameter that allows :'s in the definition value. The old syntax uses :'s as a layer id separator.

Reference:
http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/export.html



Dasa,

Thanks.  That helps.

parks
0 Kudos
ParksCamp
New Contributor III
You'll need to be using a ArcGIS Server 10 hosted service since it has added a new syntax for the layerDefs parameter that allows :'s in the definition value. The old syntax uses :'s as a layer id separator.

Reference:
http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/export.html


FYI,

I was able to find a workaround for this issue by sending the epoch time and using the sql "to_timestamp" function:

var nDate:Date = new Date();
var qTime:Number = nDate.time;
var wwaLyr:ArcGISDynamicMapServiceLayer = map.getLayer("WWA") as ArcGISDynamicMapServiceLayer;

var stringDef:String = "beginDate <= to_timestamp(qTime)";
wwaLyr.layerDefinitions = [stringDef];
wwaLyr.refresh();

0 Kudos