Hi @arkiboys ,
Thankyou for using Microsoft Q&A platform and thanks for posting your question here.
As I understand your ask here, you are trying to get the datediff between the parameter and current date and using the same in forEach activity to loop through the range. Kindly let me know if that is not the case.
To achieve the requirement , you can use ticks() function which converts the date format into int value where one tick equals 100 nanoseconds. On top of that, you can use sub() function to get the difference between two dates .
You need only one parameter 'p_StartDate' with string value . Then use the below expression in ForEach Activity:
@range(0,int(div(div(sub(ticks(formatDateTime(utcNow(),'yyyy-MM-dd')),ticks(pipeline().parameters.p_StartDate)),36000000000),24)))
Here , first div() is to convert nanosecond to hours by dividing with 36000000000 and then second div() is to convert into number of days by dividing with 24.
- When datediff is 1, Wait activity is triggered once:
- When datediff is 2 , Wait activity gets triggered twice and so on:
Hope this will help. Please let us know if any further queries.
------------------------------
- Please don't forget to click on
or upvote
button whenever the information provided helps you.
Original posters help the community find answers faster by identifying the correct answer. Here is how - Want a reminder to come back and check responses? Here is how to subscribe to a notification
- If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators