Select to view content in your preferred language

How to add current date to config.xml

1851
7
07-21-2011 09:54 AM
RuyMartinez
Emerging Contributor
Hello Everyone,

I am attempting to add the current date and add it to a query in the config.xml file for the flex viewer.

This works without any problems:

<layer label=???My Date Layer??? type=???feature??? visible=???true??? url=???http://server/arcgis/rest/services/datelayer/FeatureServer/1??? definitionexpression=???date>=???07/21/2011??????/>


I'm looking for something like this:

<layer label=???My Date Layer??? type=???feature??? visible=???true??? url=???http://server/arcgis/rest/services/datelayer/FeatureServer/1??? definitionexpression=???date>=CURRENT_DATE??? />


Has anyone else done something like this?

Thank you,
Ruy
Tags (2)
0 Kudos
7 Replies
RobertScheitlin__GISP
MVP Emeritus
Ruy,

   Have you tried GetDate()?
0 Kudos
RuyMartinez
Emerging Contributor
I've tried
<layer label=�?�My Date Layer�?� type=�?�feature�?� visible=�?�true�?� url=�?�http://server/arcgis/rest/services/datelayer/FeatureServer/1�?� definitionexpression=�?�date>=GetDate()�?�/>


<layer label=�?�My Date Layer�?� type=�?�feature�?� visible=�?�true�?� url=�?�http://server/arcgis/rest/services/datelayer/FeatureServer/1�?� definitionexpression=�?�date>='GetDate()'�?�/>


<layer label=�?�My Date Layer�?� type=�?�feature�?� visible=�?�true�?� url=�?�http://server/arcgis/rest/services/datelayer/FeatureServer/1�?� definitionexpression=�?�date>= + 'GetDate()'�?�/>


and

<layer label=�?�My Date Layer�?� type=�?�feature�?� visible=�?�true�?� url=�?�http://server/arcgis/rest/services/datelayer/FeatureServer/1�?� definitionexpression=�?�date>= + GetDate()�?�/>


None of these combinations work.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ruy,

   What is the underling data for this featureService in (SDE SQL Server or Oracle, Shapefile, FDGB, what)?
0 Kudos
RuyMartinez
Emerging Contributor
SDE SQL SERVER
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ruy,

   OK, CURRENT_DATE keyword is suppose to be supported.
0 Kudos
RuyMartinez
Emerging Contributor
Robert,

I want to thank you for taking the time to help me out.  I'm still stuck on the syntax.  Here are the latest attempts

definitionexpression=�?�date>=CURRENT_DATE�?�
definitionexpression=�?�date>=CURRENT_DATE()�?�
definitionexpression=�?�date>= + 'CURRENT_DATE'�?�
definitionexpression=�?�date>= + 'CURRENT_DATE()'�?�


Do I have to format the date before I send it in the query?  I'm not sure what else to try.

Ruy
0 Kudos
RuyMartinez
Emerging Contributor
Okay I finally go something to work!

definitionexpression="date>= DATEADD(d, DATEDIFF(d,0,GETDATE(),0)"


I found the answer here

Thanks for your help on this Robert.
Ruy
0 Kudos