Greetings! In my action list, I set a %nowDate% variable to (today - 1 month) using a GetDateTime action. I have a While Loop set up to do a series of actions until %nowDate% is equal to today. At the end of the While Loop, I want to increment %nowDate% by 1 day. I cannot figure out a way to do that. Set Variable only allows integer increments, and does not allow me to increment a date that way.
If I set %nowDate% to be a Variant instead of a DateTime variable, would that work? If not, is there a way to increment a DateTime variable by a day (or any other time period)?
Thanks,
Jonathan
Hi Jonathan,
If you know that %nowDate% should be today after the while loop, and you require the %nowDate% to have “today + 1 day”. I would simply suggest setting the variable again through the GetDateTime action.
This would really only work if after the while loop %nowDate% is today after the while loop though. I assume that’s the test in the while loop.
To do the above without having a difference in time, create a variable %todayMinusOne% which is set directly after %nowDate% is initialised. Then use the SetVariable to assign %todayMinusOne% to %nowDate%. Otherwise you will get a difference in the datetimes of how long it took to run the while loop.
Let us know how that goes for you.
That does not work the second time through the loop…the issue is that the start date is variable, and the end date is the current date. The solution I found was to use a For loop with the start date and end date, incrementing by 1. That works like a charm.
Great to hear that worked out for you in the end.