I have a very simple workflow, which primarily need to calculate difference between two dates. I have two variables with the dates that I'd like to calculate against, and I'm logging their values:
I have "Build String" action, where I try to do the actual calculation:
Unfortunately, instead of returning the number of days between two dates, t_datesDiff is containing the string with the function definition and parameters:
What is the issue here and how it can be resolved?
Solved! Go to Solution.
Ideally it should work. Instead of Build String, could you try Set Variable action? In the Value, add the function. Make sure t_datesDiff is an integer in this case and not a string. Hope it helps.
I tried what you suggested, however without success. The "Set Variable" action does not allow me to insert reference when I choose Number or Integer variable. It allows me to insert reference when I choose text variable, however the result is the same: instead of the value I have the string with the definition.
I know that my answer could look a bit stupid but sometimes I've solved similar problems in that way:
- have you tried to remove the function in the set variable action and re-enter it by selecting the function and the variables from the reference panel (don't type anything directly)?
If you need to have the days as a number variable during the workflow, you can use a Convert Value action to convert the string to a number.
I was thinking the same as Giacomo suggested. I hope you did not copy paste the function. Try deleting the action and recreating from scratch without any typing.
I've noticed that depending on SharePoint regional settings (Locale field), date time functions may not work.
I've found a workaround :
And it should work.
Hope this helps
Hi Jerzy Czopek, have you find what was causing the function to be not evaluated?
Could you share on the community what was the solution and mark the correct answer in this thread?
Thanks a lot!