cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ESSteven
Frequent Visitor

I need HELP building a flow which creates dated line items in a list for each date between two dates (start & end date) - However, It also needs only select the dates which fall on specified days between the two dates - PLEASE HELP!

I am hoping someone can help!

 

I have a list which handles 'Bookings'. Single day bookings can be placed by selecting the 'Booked - Single' option from a drop-down field which then allows the user to set a start date & this adds an item to that users availability list with their name & the date they are booked out.

 

There is also an option from the drop-down list 'Booked - Ongoing' which allows for an 'End Date & Time' field & 'Days' fields to appear. The user will select the date which the booking starts and the end date for the booking.

 

I have a need for a flow which takes everyday between the 2 dates and updates the users availability list with an item for each date so if I filter their availability down to a date between those 2 dates it shows they are booked on that date.

 

However... Frequently, it isn't every Monday - Friday between the 2 dates. On many occasions it can be just the Monday, Wednesday & Friday of each week between the two dates. Which is why I have created a 'days' multi-choice field which the user can select which days between the two dates are to be booked specifically keeping the other dates open.

 

Example:

New item:

Type: Booked - Ongoing

Start: 21/11/2019

End:  07/04/2020

Days: Monday

          Wednesday

          Friday

 

Flow - Gather what days have been selected by the user, gather the start and end date, create list items for every date which falls upon the specified days between the gathered dates including the current date if that is one of the selected days. 

 

Can anyone please assist with how I could achieve this?

 

Thank you! 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @ESSteven,

 

You can set the conditions to check the specific days by using the dayOfWeek() function, if it is 1 or 3 or 5 (Monday or Wednesday or Friday), create the item.

Annotation 2019-11-25 165254.png

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-litu-msft
Community Support
Community Support

Hi @ESSteven,

 

You can initialize two string variables to store Start Date and End Date.

 

Then Initialize a number variables to init the increase days, set its default value is 0.

 

And you want to create items according to the date, the addDays() function would help you:

addDays(variable('StartDate'),variable('Days'))

However, we need to stop it if the result of addDays is greater than the End Date.

So, we need to create a Do Until action to put the condition into it to make the create item keep going until End Date.

Annotation 2019-11-22 160018.png

 

Annotation 2019-11-22 160048.png

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-litu-msft ,

Thank you for your answer.

 

This works perfectly for a 'Block Booking' from one date to the next covering every day in between.

 

However I was looking for a solution which would allow for the selection of specific days (Monday, Wednesday & Friday) and for the same flow as you have given to run however only the Mondays, Wednesdays & Fridays in between the start & end date are created as new items.

 

Any ideas?

 

Hi @ESSteven,

 

You can set the conditions to check the specific days by using the dayOfWeek() function, if it is 1 or 3 or 5 (Monday or Wednesday or Friday), create the item.

Annotation 2019-11-25 165254.png

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power Automate User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (25,362)