Question about date comparison in sample workflow "Query Features"
Hello everyone,
I have a question about the “Query Features” sample workflow for date queries. There, you can choose whether you want to select features with dates from the last 5 or 10 years or with today's date. Each time, the following query is executed: =`${$dateField.result} >= DATE ‘${$formatDate.formatted}’`, where $dateField.result is the date field of the feature and $format.Date.formatted is the date selected by the user depending on today's date (5/10/0 years earlier than today).
I want to make a query using the same scheme that outputs features from exactly a specific selected date, and I have changed the query accordingly to: =`${$dateField.result} == DATE ‘${$formatDate.formatted}’` and, of course, adjusted the selection in the workflow accordingly.
Unfortunately, I get an error message here. What would be the correct command?
Thanks in advance!
-
Is this for the configuration of the Where clause? As far as I know SQL doesn't use ==, what if you use a single = operator?
0 -
Hi Nico,
unfortunately, doesn't work eather!
But generally the SQL statement works with “>”, “<”, “≤” etc., just not with the “=”
Any ideas?
0 -
Hi Nico,
the problem was that I used the date in the format 01.01.2025 (with dots instead of hyphens between the months and days). So the formatDate function returned this when I entered “L” as the format. Now I use “yyyy-MM-dd” and I get the date with hyphens, but also with the time. Is there a command that only outputs the time, or do I have to shorten the string to the required characters with .substring(0,10)? That seems cumbersome and error-prone to me.
Thanks for your help!
0 -
If you are trying to convert a date to the “yyyy-MM-dd” format for a WHERE clause, you can use the Format Date activity with a Custom format string to produce the desired output. In your case, using
yyyy-MM-ddas the format input, the formatted output would be something like"2025-12-15".0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
5 commentaires