Workflow QueryTask error with TO_DATE
I've hit a snag on a workflow, and hoping I'm just missing something obvious.
Within the workflow, we're creating a definition expression from a series of values entered into a form. One of the conditions the user can enter is a date range. There's a simple "Assign" task that includes the following statement:
definitionExpression & "atu _completion _date BETWEEN TO_DATE('" & fromDate.ToString("yyyy-MM-dd") & "', 'YYYY-MM-DD') AND TO_DATE('" & toDate.ToString("yyyy-MM-dd") & "', 'YYYY-MM-DD')"
The workflow does one of two things; it will either select the items via a Query Task, or filter the items on the map by applying the definition expression to the layer. When we apply the expression as a filter to the layer (SetLayerDefinition), it works fine and as expected. When selecting via the Query Task though, it throws an error. If a date range isn't used (no BETWEEN TO_DATE stuff) the Query Task works fine. The generated query with the date range works when run as a query in Oracle, so the query itself looks to be OK as far as syntax is concerned... it only fails when used in the Query Task. The exception we're getting is fairly vague:
/customer/servlet/servlet.FileDownload?file=00P6000000eltseEAA
Any ideas would be greatly appreciated. Thanks!
-
Looks like I've solved this issue actually... kind of strange.
If I change this:
definitionExpression & "atu_completion_date BETWEEN TO_DATE('" & fromDate.ToString("yyyy-MM-dd") & "', 'YYYY-MM-DD') AND TO_DATE('" & toDate.ToString("yyyy-MM-dd") & "', 'YYYY-MM-DD')"
to this:
definitionExpression & "atu_completion_date BETWEEN DATE'" & fromDate.ToString("yyyy-MM-dd") & "' AND DATE'" & toDate.ToString("yyyy-MM-dd") & "'"
it works. For some reason, the TO_DATE bit is causing problems with the QueryTask... I'm not sure why TO_DATE would cause a problem in this case, so I would be curious to know, but changing TO_DATE to DATE seems to have fixed the issue!
0 -
I'm having this same issue right now. I tried to format my query with 'Date' instead of 'To_Date' but it doesn't seem to be taken. Can you post an picture of an alert box showing your query with the actual date values?
0 -
I figured it out. Once I realized that ArcGIS Server was allowing standard queries it made sense.
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
3 Kommentare