Hi! I´m trying to query a database which has:
- A date field (month-day-year)
- A number of days to add (integer)
I want to use a query in order to add the number of days (integer, I want it to be days) to the date field, and return a date field.
I tried the following query but it doesnt work (returns null). And the function ADD_DATE is not able in appian. What can i do?
Discussion posts and replies are publicly visible
This would be far easier to do just by writing an expression using Query Entity to fetch the date from the row in question and then add the number of days to it. In general I strongly recommend against using the Query DB nodes like this unless there's absolutely no other option.
Agree with Mike - get the data but do the add operation within Appian.
You can fetch the date and the no of days to be added from the database to expression rule using the query entity and follow the below code for the desired Output. If you want to add multiple data you can use forEach().
a!localVariables( /* Fetch the date and no of days to be added using query entity*/ local!date:today(), local!noOfDays:2, local!result:local!date+local!noOfDays, local!result )
In the end I just made a sum of the process variables in the e-mail form, that was enough for me. Also, in the database I could do the same with a new custom record. Thanks!