cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ESSteven
Level: Powered On

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! 

3 REPLIES 3
Community Support Team
Community Support Team

Re: 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!

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.

ESSteven
Level: Powered On

Re: 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!

@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?

 

Community Support Team
Community Support Team

Re: 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!

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.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,001)