01-31-2024 18:03 PM - last edited 05-13-2024 07:02 AM
Ever need to get the upcoming date or dates for something in a flow?
Whether you need next Friday, next weekday, next 15th of the month, next 3rd Tuesday of every month, next last Monday of the month, next Thanksgiving, or anything else, there is very likely a way to automatically get it using this method.
Also includes an example of how to set a flow to delay until the given date & time that you have selected.
Also includes a way to get the number of weekdays / business days between two dates.
Full Flow
The flow starts by getting the current date in the selected local time-zone
It then creates a dates dataset using that current local date with a Select action set to iterate once for every day in the coming 30 years, so range(1, 10958).
{
"Date": "@{AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'd')}",
"DaysFromStartDate": @{item()},
"Year": @{int(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'yyyy'))},
"DayOfYear": @{dayOfYear(AddDays(body('Current_Date_Timezone_Adjusted'), item()))},
"Month": @{int(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'MM'))},
"DayOfMonth": @{dayOfMonth(AddDays(body('Current_Date_Timezone_Adjusted'), item()))},
"DayOfWeek": @{dayOfWeek(AddDays(body('Current_Date_Timezone_Adjusted'), item()))},
"WeekOfMonth": @{add(1,div(sub(dayOfMonth(AddDays(body('Current_Date_Timezone_Adjusted'), item())),1),7))},
"LastDayOfMonth": @{dayOfMonth(AddDays(startOfMonth(addToTime(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'd'), 1, 'Month')), -1))}
}
Example snippet of dataset JSON generated
[
{
"Date": "1/31/2024",
"DaysFromStartDate": 0,
"Year": 2024,
"DayOfYear": 31,
"Month": 1,
"DayOfMonth": 31,
"DayOfWeek": 3,
"WeekOfMonth": 5
"LastDayOfMonth": 31
},
{
"Date": "2/1/2024",
"DaysFromStartDate": 1,
"Year": 2024,
"DayOfYear": 32,
"Month": 2,
"DayOfMonth": 1,
"DayOfWeek": 4,
"WeekOfMonth": 1
"LastDayOfMonth": 29
},
{
"Date": "2/2/2024",
"DaysFromStartDate": 2,
"Year": 2024,
"DayOfYear": 33,
"Month": 2,
"DayOfMonth": 2,
"DayOfWeek": 5,
"WeekOfMonth": 1
"LastDayOfMonth": 29
},
{
"Date": "2/3/2024",
"DaysFromStartDate": 3,
"Year": 2024,
"DayOfYear": 34,
"Month": 2,
"DayOfMonth": 3,
"DayOfWeek": 6,
"WeekOfMonth": 1
"LastDayOfMonth": 29
} ...
...
...
...
{
"Date": "1/30/2054",
"DaysFromStartDate": 10957,
"Year": 2054,
"DayOfYear": 30,
"Month": 1,
"DayOfMonth": 30,
"DayOfWeek": 5,
"WeekOfMonth": 5
"LastDayOfMonth": 31
}
]
Then in every example it uses a Filter array action to filter down to the desired date or dates.
For example to get the next Friday the Filter array action filters to every date with a DayOfWeek of 5. Then the following Compose has the expression to get the Date value of the 1st item in the Filter array output array.
And if you wanted to use one of the selected dates and a time to delay the flow, then you could use the Convert time zone action set-up to generate the appropriate UTC time for the Delay until action
Import the example template flow through the legacy import or through the Solution import attachments below.
Or go to this post for the direct copy & paste option available in the classic designer.
Thanks for any feedback,
Please subscribe to my YouTube channel (https://youtube.com/@tylerkolota?si=uEGKko1U8D29CJ86).
And reach out on LinkedIn (https://www.linkedin.com/in/kolota/) if you want to hire me to consult or build more custom Microsoft solutions for you.
Copy the below scope code to your clipboard & on the classic designer go to the create new action menu, go to My clipboard, & control+V paste the scope code into the menu to get the option to insert it directly into your flow
{"id":"b9edf094-41aa-4846-a66e-a6424570f20e","brandColor":"#8C3900","connectionReferences":{},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"Get_Next_Dates","operationDefinition":{"type":"Scope","actions":{"Current_Date_Timezone_Adjusted":{"type":"Expression","kind":"ConvertTimeZone","inputs":{"baseTime":"@utcNow()","formatString":"d","sourceTimeZone":"UTC","destinationTimeZone":"Eastern Standard Time"},"runAfter":{},"metadata":{"operationMetadataId":"094d7a36-aec0-4604-905d-843af2bbc454"}},"Select_Generate_Dates_Dataset":{"type":"Select","inputs":{"from":"@range(1, 10958)","select":{"Date":"@{AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'd')}","DaysFromStartDate":"@item()","Year":"@int(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'yyyy'))","DayOfYear":"@dayOfYear(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","Month":"@int(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'MM'))","DayOfMonth":"@dayOfMonth(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","DayOfWeek":"@dayOfWeek(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","MonthWeekCount":"@add(1,div(sub(dayOfMonth(AddDays(body('Current_Date_Timezone_Adjusted'), item())),1),7))"}},"runAfter":{"Current_Date_Timezone_Adjusted":["Succeeded"]},"description":"By default set to create a record for each day in the next 30 years. 365.25 x 30 = 10958, in range(1, 10958). To include current date, change range start to 0, like range(0, 10958).","metadata":{"operationMetadataId":"918107d0-9263-49ff-a79e-74c31ef5c65b"}},"Filter_array_Day_of_Week":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@equals(item()['DayOfWeek'],5)"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"description":"Insert the desired day of week number on the right side of the condition: 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday","metadata":{"operationMetadataId":"9dc657eb-1186-4e48-b51d-83530544c8ab"}},"Filter_array_Thanksgivings":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(and(equals(item()['Month'],11),equals(item()['DayOfWeek'],4)),equals(item()['MonthWeekCount'],4))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"bf4ebf3d-b74c-4b16-97ea-7502b29f2af5"}},"Filter_array_All_3rd_Tuesdays":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(equals(item()['MonthWeekCount'],3), equals(item()['DayOfWeek'],2))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"46e324e6-37a2-4d90-a4cd-8ecfd43b9873"}},"Filter_array_Next_15ths_of_The_Month":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@equals(item()['DayOfMonth'],15)"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"01cdc83c-06bc-45b5-a85b-d237e64aaf57"}},"Filter_array_Only_Weekdays":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(not(equals(item()['DayOfWeek'],6)),not(equals(item()['DayOfWeek'],7)))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"cf8d69a7-dbc4-4114-9d7d-5f200fd82e8b"}},"Compose_Date_of_Next_Day_of_Week":{"type":"Compose","inputs":"@body('Filter_array_Day_of_Week')[0]['Date']","runAfter":{"Filter_array_Day_of_Week":["Succeeded"]},"description":"For example, the date of the next Friday","metadata":{"operationMetadataId":"510e52af-8da0-4466-9e07-50935c2b84d0"}},"Compose_Date_of_4th_Next_Day_of_Week":{"type":"Compose","inputs":"@body('Filter_array_Day_of_Week')[3]['Date']","runAfter":{"Compose_Date_of_Next_Day_of_Week":["Succeeded"]},"description":"For example, the date of the 4th next Friday","metadata":{"operationMetadataId":"3fb79319-6713-4502-ab50-c69fddaa38c7"}},"Compose_Date_of_Next_Thanksgiving":{"type":"Compose","inputs":"@body('Filter_array_Thanksgivings')[0]['Date']","runAfter":{"Filter_array_Thanksgivings":["Succeeded"]},"metadata":{"operationMetadataId":"28645370-3281-4238-acb4-5df4b9991aed"}},"Apply_to_each_Thanksgiving":{"type":"Foreach","foreach":"@body('Filter_array_Thanksgivings')","actions":{"Compose_Thanksgiving_Date":{"type":"Compose","inputs":"@items('Apply_to_each_Thanksgiving')['Date']","runAfter":{},"metadata":{"operationMetadataId":"7b1d4395-3d63-43e5-8d7d-dc636143513e"}}},"runAfter":{"Compose_Date_of_Next_Thanksgiving":["Succeeded"]},"metadata":{"operationMetadataId":"2728f8f9-2d7f-41f2-9cdd-0bf4af803c95"}},"Apply_to_each_3rd_Tuesday":{"type":"Foreach","foreach":"@take(body('Filter_array_All_3rd_Tuesdays'),12)","actions":{"Compose_Tuesday_Date":{"type":"Compose","inputs":"@items('Apply_to_each_3rd_Tuesday')['Date']","runAfter":{},"metadata":{"operationMetadataId":"eb46ce25-60bf-4304-bff6-041233477b16"}}},"runAfter":{"Filter_array_All_3rd_Tuesdays":["Succeeded"]},"description":"Set the take( ) expression to only take the 1st 12 records so it only applies to the 3rd Tuesdays for the next year","metadata":{"operationMetadataId":"f23e5acf-a241-49ed-b52f-9b9f6c449105"}},"Compose_Next_Weekday_Date":{"type":"Compose","inputs":"@body('Filter_array_Only_Weekdays')?[0]?['Date']","runAfter":{"Filter_array_Only_Weekdays":["Succeeded"]},"metadata":{"operationMetadataId":"5af898b2-9d3d-4217-9d85-1ea7509c9016"}},"Compose_Next_15th_of_The_Month":{"type":"Compose","inputs":"@body('Filter_array_Next_15ths_of_The_Month')[0]['Date']","runAfter":{"Filter_array_Next_15ths_of_The_Month":["Succeeded"]},"metadata":{"operationMetadataId":"7d51a2a4-a7a7-4c84-97a8-abb90e6f8e08"}},"Enter_time_and_convert_time_zone":{"type":"Expression","kind":"ConvertTimeZone","inputs":{"baseTime":"@{outputs('Compose_Next_15th_of_The_Month')} 17:30","formatString":"u","sourceTimeZone":"Eastern Standard Time","destinationTimeZone":"UTC"},"runAfter":{"Compose_Next_15th_of_The_Month":["Succeeded"]},"description":"For Base Time, after the date dynamic content, enter the time you want to add to the date on a 24hour clock. Actions like Delay until require UTC time, so enter your time zone in Source Time Zone to convert it to UTC time.","metadata":{"operationMetadataId":"a74a7fea-bf54-4602-b557-ecfab4ccccd7"}},"Delay_until":{"type":"Wait","inputs":{"until":{"timestamp":"@body('Enter_time_and_convert_time_zone')"}},"runAfter":{"Enter_time_and_convert_time_zone":["Succeeded"]},"metadata":{"operationMetadataId":"217b74f8-2bf2-493b-97fe-39363813513d"}}},"runAfter":{}}}
Copy the below scope code to your clipboard & on the classic designer go to the create new action menu, go to My clipboard, & control+V paste the scope code into the menu to get the option to insert it directly into your flow
{"id":"80a73ecb-5017-42cd-96db-25dee4f16a5a","brandColor":"#8C3900","connectionReferences":{},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"Get_Next_Dates","operationDefinition":{"type":"Scope","actions":{"Current_Date_Timezone_Adjusted":{"type":"Expression","kind":"ConvertTimeZone","inputs":{"baseTime":"@utcNow()","formatString":"d","sourceTimeZone":"UTC","destinationTimeZone":"Eastern Standard Time"},"runAfter":{},"metadata":{"operationMetadataId":"094d7a36-aec0-4604-905d-843af2bbc454"}},"Select_Generate_Dates_Dataset":{"type":"Select","inputs":{"from":"@range(1, 10958)","select":{"Date":"@AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'd')","DaysFromStartDate":"@item()","Year":"@int(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'yyyy'))","DayOfYear":"@dayOfYear(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","Month":"@int(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'MM'))","DayOfMonth":"@dayOfMonth(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","DayOfWeek":"@dayOfWeek(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","WeekOfMonth":"@add(1,div(sub(dayOfMonth(AddDays(body('Current_Date_Timezone_Adjusted'), item())),1),7))"}},"runAfter":{"Current_Date_Timezone_Adjusted":["Succeeded"]},"description":"By default set to create a record for each day in the next 30 years. 365.25 x 30 = 10958, in range(1, 10958). To include current date, change range start to 0, like range(0, 10958).","metadata":{"operationMetadataId":"918107d0-9263-49ff-a79e-74c31ef5c65b"}},"Filter_array_Day_of_Week":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@equals(item()['DayOfWeek'],5)"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"description":"Insert the desired day of week number on the right side of the condition: 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday","metadata":{"operationMetadataId":"9dc657eb-1186-4e48-b51d-83530544c8ab"}},"Filter_array_Thanksgivings":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(and(equals(item()['Month'],11),equals(item()['DayOfWeek'],4)),equals(item()['WeekOfMonth'],4))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"bf4ebf3d-b74c-4b16-97ea-7502b29f2af5"}},"Filter_array_All_3rd_Tuesdays":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(equals(item()['WeekOfMonth'],3), equals(item()['DayOfWeek'],2))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"46e324e6-37a2-4d90-a4cd-8ecfd43b9873"}},"Filter_array_Next_15ths_of_The_Month":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@equals(item()['DayOfMonth'],15)"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"01cdc83c-06bc-45b5-a85b-d237e64aaf57"}},"Filter_array_Only_Weekdays":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(not(equals(item()['DayOfWeek'],6)),not(equals(item()['DayOfWeek'],7)))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"cf8d69a7-dbc4-4114-9d7d-5f200fd82e8b"}},"Compose_Date_of_Next_Day_of_Week":{"type":"Compose","inputs":"@body('Filter_array_Day_of_Week')[0]['Date']","runAfter":{"Filter_array_Day_of_Week":["Succeeded"]},"description":"For example, the date of the next Friday","metadata":{"operationMetadataId":"510e52af-8da0-4466-9e07-50935c2b84d0"}},"Compose_Date_of_4th_Next_Day_of_Week":{"type":"Compose","inputs":"@body('Filter_array_Day_of_Week')[3]['Date']","runAfter":{"Compose_Date_of_Next_Day_of_Week":["Succeeded"]},"description":"For example, the date of the 4th next Friday","metadata":{"operationMetadataId":"3fb79319-6713-4502-ab50-c69fddaa38c7"}},"Compose_Date_of_Next_Thanksgiving":{"type":"Compose","inputs":"@body('Filter_array_Thanksgivings')[0]['Date']","runAfter":{"Filter_array_Thanksgivings":["Succeeded"]},"metadata":{"operationMetadataId":"28645370-3281-4238-acb4-5df4b9991aed"}},"Apply_to_each_Thanksgiving":{"type":"Foreach","foreach":"@body('Filter_array_Thanksgivings')","actions":{"Compose_Thanksgiving_Date":{"type":"Compose","inputs":"@items('Apply_to_each_Thanksgiving')['Date']","runAfter":{},"metadata":{"operationMetadataId":"7b1d4395-3d63-43e5-8d7d-dc636143513e"}}},"runAfter":{"Compose_Date_of_Next_Thanksgiving":["Succeeded"]},"metadata":{"operationMetadataId":"2728f8f9-2d7f-41f2-9cdd-0bf4af803c95"}},"Apply_to_each_3rd_Tuesday":{"type":"Foreach","foreach":"@take(body('Filter_array_All_3rd_Tuesdays'),12)","actions":{"Compose_Tuesday_Date":{"type":"Compose","inputs":"@items('Apply_to_each_3rd_Tuesday')['Date']","runAfter":{},"metadata":{"operationMetadataId":"eb46ce25-60bf-4304-bff6-041233477b16"}}},"runAfter":{"Filter_array_All_3rd_Tuesdays":["Succeeded"]},"description":"Set the take( ) expression to only take the 1st 12 records so it only applies to the 3rd Tuesdays for the next year","metadata":{"operationMetadataId":"f23e5acf-a241-49ed-b52f-9b9f6c449105"}},"Compose_Next_Weekday_Date":{"type":"Compose","inputs":"@body('Filter_array_Only_Weekdays')?[0]?['Date']","runAfter":{"Filter_array_Only_Weekdays":["Succeeded"]},"metadata":{"operationMetadataId":"5af898b2-9d3d-4217-9d85-1ea7509c9016"}},"Compose_Next_15th_of_The_Month":{"type":"Compose","inputs":"@body('Filter_array_Next_15ths_of_The_Month')[0]['Date']","runAfter":{"Filter_array_Next_15ths_of_The_Month":["Succeeded"]},"metadata":{"operationMetadataId":"7d51a2a4-a7a7-4c84-97a8-abb90e6f8e08"}},"Enter_time_and_convert_time_zone":{"type":"Expression","kind":"ConvertTimeZone","inputs":{"baseTime":"@{outputs('Compose_Next_15th_of_The_Month')} 17:30","formatString":"u","sourceTimeZone":"Eastern Standard Time","destinationTimeZone":"UTC"},"runAfter":{"Compose_Next_15th_of_The_Month":["Succeeded"]},"description":"For Base Time, after the date dynamic content, enter the time you want to add to the date on a 24hour clock. Actions like Delay until require UTC time, so enter your time zone in Source Time Zone to convert it to UTC time.","metadata":{"operationMetadataId":"a74a7fea-bf54-4602-b557-ecfab4ccccd7"}},"Delay_until":{"type":"Wait","inputs":{"until":{"timestamp":"@body('Enter_time_and_convert_time_zone')"}},"runAfter":{"Enter_time_and_convert_time_zone":["Succeeded"]},"metadata":{"operationMetadataId":"217b74f8-2bf2-493b-97fe-39363813513d"}}},"runAfter":{},"metadata":{"operationMetadataId":"f2e29e4e-0a77-4b0e-9525-ff0334a2aeac"}}}
Copy the below scope code to your clipboard & on the classic designer go to the create new action menu, go to My clipboard, & control+V paste the scope code into the menu to get the option to insert it directly into your flow
{"id":"fe121326-efb3-4b39-99e2-c8e8e07a333d","brandColor":"#8C3900","connectionReferences":{},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"Get_Next_Dates","operationDefinition":{"type":"Scope","actions":{"Current_Date_Timezone_Adjusted":{"type":"Expression","kind":"ConvertTimeZone","inputs":{"baseTime":"@utcNow()","formatString":"d","sourceTimeZone":"UTC","destinationTimeZone":"Eastern Standard Time"},"runAfter":{},"metadata":{"operationMetadataId":"094d7a36-aec0-4604-905d-843af2bbc454"}},"Select_Generate_Dates_Dataset":{"type":"Select","inputs":{"from":"@range(1, 10958)","select":{"Date":"@{AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'd')}","DaysFromStartDate":"@item()","Year":"@int(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'yyyy'))","DayOfYear":"@dayOfYear(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","Month":"@int(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'MM'))","DayOfMonth":"@dayOfMonth(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","DayOfWeek":"@dayOfWeek(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","WeekOfMonth":"@add(1, div(sub(dayOfMonth(AddDays(body('Current_Date_Timezone_Adjusted'), item())), 1), 7))","LastDayOfMonth":"@dayOfMonth(AddDays(startOfMonth(addToTime(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'd'), 1, 'Month')), -1))"}},"runAfter":{"Current_Date_Timezone_Adjusted":["Succeeded"]},"description":"By default set to create a record for each day in the next 30 years. 365.25 x 30 = 10958, in range(1, 10958). To include current date, change range start to 0, like range(0, 10958).","metadata":{"operationMetadataId":"918107d0-9263-49ff-a79e-74c31ef5c65b"}},"Filter_array_Day_of_Week":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@equals(item()['DayOfWeek'], 5)"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"description":"Insert the desired day of week number on the right side of the condition: 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday","metadata":{"operationMetadataId":"9dc657eb-1186-4e48-b51d-83530544c8ab"}},"Filter_array_Thanksgivings":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(and(equals(item()['Month'], 11), equals(item()['DayOfWeek'], 4)), equals(item()['WeekOfMonth'], 4))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"bf4ebf3d-b74c-4b16-97ea-7502b29f2af5"}},"Filter_array_All_3rd_Tuesdays":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(equals(item()['WeekOfMonth'], 3), equals(item()['DayOfWeek'], 2))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"46e324e6-37a2-4d90-a4cd-8ecfd43b9873"}},"Filter_array_Next_15ths_of_The_Month":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@equals(item()['DayOfMonth'], 15)"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"01cdc83c-06bc-45b5-a85b-d237e64aaf57"}},"Filter_array_Only_Weekdays":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(not(equals(item()['DayOfWeek'], 6)), not(equals(item()['DayOfWeek'], 7)))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"cf8d69a7-dbc4-4114-9d7d-5f200fd82e8b"}},"Compose_Date_of_Next_Day_of_Week":{"type":"Compose","inputs":"@body('Filter_array_Day_of_Week')[0]['Date']","runAfter":{"Filter_array_Day_of_Week":["Succeeded"]},"description":"For example, the date of the next Friday","metadata":{"operationMetadataId":"510e52af-8da0-4466-9e07-50935c2b84d0"}},"Compose_Date_of_4th_Next_Day_of_Week":{"type":"Compose","inputs":"@body('Filter_array_Day_of_Week')[3]['Date']","runAfter":{"Compose_Date_of_Next_Day_of_Week":["Succeeded"]},"description":"For example, the date of the 4th next Friday","metadata":{"operationMetadataId":"3fb79319-6713-4502-ab50-c69fddaa38c7"}},"Compose_Date_of_Next_Thanksgiving":{"type":"Compose","inputs":"@body('Filter_array_Thanksgivings')[0]['Date']","runAfter":{"Filter_array_Thanksgivings":["Succeeded"]},"metadata":{"operationMetadataId":"28645370-3281-4238-acb4-5df4b9991aed"}},"Apply_to_each_Thanksgiving":{"type":"Foreach","foreach":"@body('Filter_array_Thanksgivings')","actions":{"Compose_Thanksgiving_Date":{"type":"Compose","inputs":"@items('Apply_to_each_Thanksgiving')['Date']","runAfter":{},"metadata":{"operationMetadataId":"7b1d4395-3d63-43e5-8d7d-dc636143513e"}}},"runAfter":{"Compose_Date_of_Next_Thanksgiving":["Succeeded"]},"metadata":{"operationMetadataId":"2728f8f9-2d7f-41f2-9cdd-0bf4af803c95"}},"Apply_to_each_3rd_Tuesday":{"type":"Foreach","foreach":"@take(body('Filter_array_All_3rd_Tuesdays'), 12)","actions":{"Compose_Tuesday_Date":{"type":"Compose","inputs":"@items('Apply_to_each_3rd_Tuesday')['Date']","runAfter":{},"metadata":{"operationMetadataId":"eb46ce25-60bf-4304-bff6-041233477b16"}}},"runAfter":{"Filter_array_All_3rd_Tuesdays":["Succeeded"]},"description":"Set the take( ) expression to only take the 1st 12 records so it only applies to the 3rd Tuesdays for the next year","metadata":{"operationMetadataId":"f23e5acf-a241-49ed-b52f-9b9f6c449105"}},"Compose_Next_Weekday_Date":{"type":"Compose","inputs":"@body('Filter_array_Only_Weekdays')?[0]?['Date']","runAfter":{"Filter_array_Only_Weekdays":["Succeeded"]},"metadata":{"operationMetadataId":"5af898b2-9d3d-4217-9d85-1ea7509c9016"}},"Compose_Next_15th_of_The_Month":{"type":"Compose","inputs":"@body('Filter_array_Next_15ths_of_The_Month')[0]['Date']","runAfter":{"Filter_array_Next_15ths_of_The_Month":["Succeeded"]},"metadata":{"operationMetadataId":"7d51a2a4-a7a7-4c84-97a8-abb90e6f8e08"}},"Enter_time_and_convert_time_zone":{"type":"Expression","kind":"ConvertTimeZone","inputs":{"baseTime":"@{outputs('Compose_Next_15th_of_The_Month')} 17:30","formatString":"u","sourceTimeZone":"Eastern Standard Time","destinationTimeZone":"UTC"},"runAfter":{"Compose_Next_15th_of_The_Month":["Succeeded"]},"description":"For Base Time, after the date dynamic content, enter the time you want to add to the date on a 24hour clock. Actions like Delay until require UTC time, so enter your time zone in Source Time Zone to convert it to UTC time.","metadata":{"operationMetadataId":"a74a7fea-bf54-4602-b557-ecfab4ccccd7"}},"Delay_until":{"type":"Wait","inputs":{"until":{"timestamp":"@body('Enter_time_and_convert_time_zone')"}},"runAfter":{"Enter_time_and_convert_time_zone":["Succeeded"]},"metadata":{"operationMetadataId":"217b74f8-2bf2-493b-97fe-39363813513d"}},"Filter_array_All_last_Mondays_of_The_Month":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(less(sub(item()['LastDayOfMonth'], item()['DayOfMonth']), 7), equals(item()['DayOfWeek'], 1))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"7419c81d-ecc5-45f8-a8f5-89d9495a3765"}},"Compose_Next_last_Monday_of_The_Month":{"type":"Compose","inputs":"@body('Filter_array_All_last_Mondays_of_The_Month')?[0]?['Date']","runAfter":{"Filter_array_All_last_Mondays_of_The_Month":["Succeeded"]},"metadata":{"operationMetadataId":"5af898b2-9d3d-4217-9d85-1ea7509c9016"}}},"runAfter":{},"metadata":{"operationMetadataId":"f2e29e4e-0a77-4b0e-9525-ff0334a2aeac"}}}
Copy the below scope code to your clipboard & on the classic designer go to the create new action menu, go to My clipboard, & control+V paste the scope code into the menu to get the option to insert it directly into your flow
{"id":"76e01ee2-b189-47bf-9881-6ee7dcdc32ed","brandColor":"#8C3900","connectionReferences":{},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"Get_Next_Dates","operationDefinition":{"type":"Scope","actions":{"Current_Date_Timezone_Adjusted":{"type":"Expression","kind":"ConvertTimeZone","inputs":{"baseTime":"@utcNow()","formatString":"d","sourceTimeZone":"UTC","destinationTimeZone":"Eastern Standard Time"},"runAfter":{},"metadata":{"operationMetadataId":"094d7a36-aec0-4604-905d-843af2bbc454"}},"Select_Generate_Dates_Dataset":{"type":"Select","inputs":{"from":"@range(1, 10958)","select":{"Date":"@{AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'd')}","DaysFromStartDate":"@item()","Year":"@int(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'yyyy'))","DayOfYear":"@dayOfYear(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","Month":"@int(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'MM'))","DayOfMonth":"@dayOfMonth(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","DayOfWeek":"@dayOfWeek(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","WeekOfMonth":"@add(1,div(sub(dayOfMonth(AddDays(body('Current_Date_Timezone_Adjusted'), item())),1),7))","LastDayOfMonth":"@dayOfMonth(AddDays(startOfMonth(addToTime(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'd'), 1, 'Month')), -1))"}},"runAfter":{"Current_Date_Timezone_Adjusted":["Succeeded"]},"description":"By default set to create a record for each day in the next 30 years. 365.25 x 30 = 10958, in range(1, 10958). To include current date, change range start to 0, like range(0, 10958).","metadata":{"operationMetadataId":"918107d0-9263-49ff-a79e-74c31ef5c65b"}},"Filter_array_Day_of_Week":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@equals(item()['DayOfWeek'],5)"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"description":"Insert the desired day of week number on the right side of the condition: 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday","metadata":{"operationMetadataId":"9dc657eb-1186-4e48-b51d-83530544c8ab"}},"Filter_array_Thanksgivings":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(and(equals(item()['Month'],11),equals(item()['DayOfWeek'],4)),equals(item()['WeekOfMonth'],4))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"bf4ebf3d-b74c-4b16-97ea-7502b29f2af5"}},"Filter_array_All_3rd_Tuesdays":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(equals(item()['WeekOfMonth'],3), equals(item()['DayOfWeek'],2))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"46e324e6-37a2-4d90-a4cd-8ecfd43b9873"}},"Filter_array_Next_15ths_of_The_Month":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@equals(item()['DayOfMonth'],15)"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"01cdc83c-06bc-45b5-a85b-d237e64aaf57"}},"Filter_array_Only_Weekdays":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(not(equals(item()['DayOfWeek'],6)),not(equals(item()['DayOfWeek'],7)))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"cf8d69a7-dbc4-4114-9d7d-5f200fd82e8b"}},"Compose_Date_of_Next_Day_of_Week":{"type":"Compose","inputs":"@body('Filter_array_Day_of_Week')[0]['Date']","runAfter":{"Filter_array_Day_of_Week":["Succeeded"]},"description":"For example, the date of the next Friday","metadata":{"operationMetadataId":"510e52af-8da0-4466-9e07-50935c2b84d0"}},"Compose_Date_of_4th_Next_Day_of_Week":{"type":"Compose","inputs":"@body('Filter_array_Day_of_Week')[3]['Date']","runAfter":{"Compose_Date_of_Next_Day_of_Week":["Succeeded"]},"description":"For example, the date of the 4th next Friday","metadata":{"operationMetadataId":"3fb79319-6713-4502-ab50-c69fddaa38c7"}},"Compose_Date_of_Next_Thanksgiving":{"type":"Compose","inputs":"@body('Filter_array_Thanksgivings')[0]['Date']","runAfter":{"Filter_array_Thanksgivings":["Succeeded"]},"metadata":{"operationMetadataId":"28645370-3281-4238-acb4-5df4b9991aed"}},"Apply_to_each_Thanksgiving":{"type":"Foreach","foreach":"@body('Filter_array_Thanksgivings')","actions":{"Compose_Thanksgiving_Date":{"type":"Compose","inputs":"@items('Apply_to_each_Thanksgiving')['Date']","runAfter":{},"metadata":{"operationMetadataId":"7b1d4395-3d63-43e5-8d7d-dc636143513e"}}},"runAfter":{"Compose_Date_of_Next_Thanksgiving":["Succeeded"]},"metadata":{"operationMetadataId":"2728f8f9-2d7f-41f2-9cdd-0bf4af803c95"}},"Apply_to_each_3rd_Tuesday":{"type":"Foreach","foreach":"@take(body('Filter_array_All_3rd_Tuesdays'),12)","actions":{"Compose_Tuesday_Date":{"type":"Compose","inputs":"@items('Apply_to_each_3rd_Tuesday')['Date']","runAfter":{},"metadata":{"operationMetadataId":"eb46ce25-60bf-4304-bff6-041233477b16"}}},"runAfter":{"Filter_array_All_3rd_Tuesdays":["Succeeded"]},"description":"Set the take( ) expression to only take the 1st 12 records so it only applies to the 3rd Tuesdays for the next year","metadata":{"operationMetadataId":"f23e5acf-a241-49ed-b52f-9b9f6c449105"}},"Compose_Next_Weekday_Date":{"type":"Compose","inputs":"@body('Filter_array_Only_Weekdays')?[0]?['Date']","runAfter":{"Filter_array_Only_Weekdays":["Succeeded"]},"metadata":{"operationMetadataId":"5af898b2-9d3d-4217-9d85-1ea7509c9016"}},"Compose_Next_15th_of_The_Month":{"type":"Compose","inputs":"@body('Filter_array_Next_15ths_of_The_Month')[0]['Date']","runAfter":{"Filter_array_Next_15ths_of_The_Month":["Succeeded"]},"metadata":{"operationMetadataId":"7d51a2a4-a7a7-4c84-97a8-abb90e6f8e08"}},"Enter_time_and_convert_time_zone":{"type":"Expression","kind":"ConvertTimeZone","inputs":{"baseTime":"@{outputs('Compose_Next_15th_of_The_Month')} 17:30","formatString":"u","sourceTimeZone":"Eastern Standard Time","destinationTimeZone":"UTC"},"runAfter":{"Compose_Next_15th_of_The_Month":["Succeeded"]},"description":"For Base Time, after the date dynamic content, enter the time you want to add to the date on a 24hour clock. Actions like Delay until require UTC time, so enter your time zone in Source Time Zone to convert it to UTC time.","metadata":{"operationMetadataId":"a74a7fea-bf54-4602-b557-ecfab4ccccd7"}},"Delay_until":{"type":"Wait","inputs":{"until":{"timestamp":"@body('Enter_time_and_convert_time_zone')"}},"runAfter":{"Enter_time_and_convert_time_zone":["Succeeded"]},"metadata":{"operationMetadataId":"217b74f8-2bf2-493b-97fe-39363813513d"}},"Filter_array_All_Last_Mondays_of_The_Month":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(less(sub(item()['LastDayOfMonth'],item()['DayOfMonth']),7),equals(item()['DayOfWeek'],1))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"7419c81d-ecc5-45f8-a8f5-89d9495a3765"}},"Compose_Next_last_Monday_of_The_Month":{"type":"Compose","inputs":"@body('Filter_array_All_Last_Mondays_of_The_Month')?[0]?['Date']","runAfter":{"Filter_array_All_Last_Mondays_of_The_Month":["Succeeded"]},"metadata":{"operationMetadataId":"5af898b2-9d3d-4217-9d85-1ea7509c9016"}},"Filter_array_Weekdays_Between_Two_Dates":{"type":"Query","inputs":{"from":"@body('Filter_array_Only_Weekdays')","where":"@and(greater(formatDateTime(item()?['Date']), formatDateTime('6/1/2030')), less(formatDateTime(item()?['Date']), formatDateTime('8/15/2030')))"},"runAfter":{"Compose_Next_Weekday_Date":["Succeeded"]},"description":"You must use formatDateTime( ) on all dates used in the filter conditional","metadata":{"operationMetadataId":"4891f496-c2ad-465c-9125-d035c907b146"}},"Compose_Number_of_Weekdays_Between_Two_Dates":{"type":"Compose","inputs":"@length(body('Filter_array_Weekdays_Between_Two_Dates'))","runAfter":{"Filter_array_Weekdays_Between_Two_Dates":["Succeeded"]},"metadata":{"operationMetadataId":"ae3b94e2-e842-4caa-960a-95af8b811243"}}},"runAfter":{},"metadata":{"operationMetadataId":"f2e29e4e-0a77-4b0e-9525-ff0334a2aeac"}}}
Hi.
Query filter in "Filter array Only Weekdays" is wrong. Sunday is 0 returned by dayOfWeek not 7 as in your solution:
"@and(not(equals(item()['DayOfWeek'],6)),not(equals(item()['DayOfWeek'],7)))"
Copy the below scope code to your clipboard & on the classic designer go to the create new action menu, go to My clipboard, & control+V paste the scope code into the menu to get the option to insert it directly into your flow
{"id":"504579a0-8af2-4fd7-9d98-974a8e3d04c2","brandColor":"#8C3900","connectionReferences":{},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"Get_Next_Dates","operationDefinition":{"type":"Scope","actions":{"Current_Date_Timezone_Adjusted":{"type":"Expression","kind":"ConvertTimeZone","inputs":{"baseTime":"@utcNow()","formatString":"d","sourceTimeZone":"UTC","destinationTimeZone":"Eastern Standard Time"},"runAfter":{},"metadata":{"operationMetadataId":"094d7a36-aec0-4604-905d-843af2bbc454"}},"Select_Generate_Dates_Dataset":{"type":"Select","inputs":{"from":"@range(1, 10958)","select":{"Date":"@{AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'd')}","DaysFromStartDate":"@item()","Year":"@int(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'yyyy'))","DayOfYear":"@dayOfYear(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","Month":"@int(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'MM'))","DayOfMonth":"@dayOfMonth(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","DayOfWeek":"@dayOfWeek(AddDays(body('Current_Date_Timezone_Adjusted'), item()))","WeekOfMonth":"@add(1, div(sub(dayOfMonth(AddDays(body('Current_Date_Timezone_Adjusted'), item())), 1), 7))","LastDayOfMonth":"@dayOfMonth(AddDays(startOfMonth(addToTime(AddDays(body('Current_Date_Timezone_Adjusted'), item(), 'd'), 1, 'Month')), -1))"}},"runAfter":{"Current_Date_Timezone_Adjusted":["Succeeded"]},"description":"By default set to create a record for each day in the next 30 years. 365.25 x 30 = 10958, in range(1, 10958). To include current date, change range start to 0, like range(0, 10958).","metadata":{"operationMetadataId":"918107d0-9263-49ff-a79e-74c31ef5c65b"}},"Filter_array_Day_of_Week":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@equals(item()['DayOfWeek'], 5)"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"description":"Insert the desired day of week number on the right side of the condition: 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday","metadata":{"operationMetadataId":"9dc657eb-1186-4e48-b51d-83530544c8ab"}},"Filter_array_Thanksgivings":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(and(equals(item()['Month'], 11), equals(item()['DayOfWeek'], 4)), equals(item()['WeekOfMonth'], 4))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"bf4ebf3d-b74c-4b16-97ea-7502b29f2af5"}},"Filter_array_All_3rd_Tuesdays":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(equals(item()['WeekOfMonth'], 3), equals(item()['DayOfWeek'], 2))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"46e324e6-37a2-4d90-a4cd-8ecfd43b9873"}},"Filter_array_Next_15ths_of_The_Month":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@equals(item()['DayOfMonth'], 15)"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"01cdc83c-06bc-45b5-a85b-d237e64aaf57"}},"Filter_array_Only_Weekdays":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(not(equals(item()['DayOfWeek'],6)),not(equals(item()['DayOfWeek'],0)))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"cf8d69a7-dbc4-4114-9d7d-5f200fd82e8b"}},"Compose_Date_of_Next_Day_of_Week":{"type":"Compose","inputs":"@body('Filter_array_Day_of_Week')[0]['Date']","runAfter":{"Filter_array_Day_of_Week":["Succeeded"]},"description":"For example, the date of the next Friday","metadata":{"operationMetadataId":"510e52af-8da0-4466-9e07-50935c2b84d0"}},"Compose_Date_of_4th_Next_Day_of_Week":{"type":"Compose","inputs":"@body('Filter_array_Day_of_Week')[3]['Date']","runAfter":{"Compose_Date_of_Next_Day_of_Week":["Succeeded"]},"description":"For example, the date of the 4th next Friday","metadata":{"operationMetadataId":"3fb79319-6713-4502-ab50-c69fddaa38c7"}},"Compose_Date_of_Next_Thanksgiving":{"type":"Compose","inputs":"@body('Filter_array_Thanksgivings')[0]['Date']","runAfter":{"Filter_array_Thanksgivings":["Succeeded"]},"metadata":{"operationMetadataId":"28645370-3281-4238-acb4-5df4b9991aed"}},"Apply_to_each_Thanksgiving":{"type":"Foreach","foreach":"@body('Filter_array_Thanksgivings')","actions":{"Compose_Thanksgiving_Date":{"type":"Compose","inputs":"@items('Apply_to_each_Thanksgiving')['Date']","runAfter":{},"metadata":{"operationMetadataId":"7b1d4395-3d63-43e5-8d7d-dc636143513e"}}},"runAfter":{"Compose_Date_of_Next_Thanksgiving":["Succeeded"]},"metadata":{"operationMetadataId":"2728f8f9-2d7f-41f2-9cdd-0bf4af803c95"}},"Apply_to_each_3rd_Tuesday":{"type":"Foreach","foreach":"@take(body('Filter_array_All_3rd_Tuesdays'), 12)","actions":{"Compose_Tuesday_Date":{"type":"Compose","inputs":"@items('Apply_to_each_3rd_Tuesday')['Date']","runAfter":{},"metadata":{"operationMetadataId":"eb46ce25-60bf-4304-bff6-041233477b16"}}},"runAfter":{"Filter_array_All_3rd_Tuesdays":["Succeeded"]},"description":"Set the take( ) expression to only take the 1st 12 records so it only applies to the 3rd Tuesdays for the next year","metadata":{"operationMetadataId":"f23e5acf-a241-49ed-b52f-9b9f6c449105"}},"Compose_Next_Weekday_Date":{"type":"Compose","inputs":"@body('Filter_array_Only_Weekdays')?[0]?['Date']","runAfter":{"Filter_array_Only_Weekdays":["Succeeded"]},"metadata":{"operationMetadataId":"5af898b2-9d3d-4217-9d85-1ea7509c9016"}},"Compose_Next_15th_of_The_Month":{"type":"Compose","inputs":"@body('Filter_array_Next_15ths_of_The_Month')[0]['Date']","runAfter":{"Filter_array_Next_15ths_of_The_Month":["Succeeded"]},"metadata":{"operationMetadataId":"7d51a2a4-a7a7-4c84-97a8-abb90e6f8e08"}},"Enter_time_and_convert_time_zone":{"type":"Expression","kind":"ConvertTimeZone","inputs":{"baseTime":"@{outputs('Compose_Next_15th_of_The_Month')} 17:30","formatString":"u","sourceTimeZone":"Eastern Standard Time","destinationTimeZone":"UTC"},"runAfter":{"Compose_Next_15th_of_The_Month":["Succeeded"]},"description":"For Base Time, after the date dynamic content, enter the time you want to add to the date on a 24hour clock. Actions like Delay until require UTC time, so enter your time zone in Source Time Zone to convert it to UTC time.","metadata":{"operationMetadataId":"a74a7fea-bf54-4602-b557-ecfab4ccccd7"}},"Delay_until":{"type":"Wait","inputs":{"until":{"timestamp":"@body('Enter_time_and_convert_time_zone')"}},"runAfter":{"Enter_time_and_convert_time_zone":["Succeeded"]},"metadata":{"operationMetadataId":"217b74f8-2bf2-493b-97fe-39363813513d"}},"Filter_array_All_Last_Mondays_of_The_Month":{"type":"Query","inputs":{"from":"@body('Select_Generate_Dates_Dataset')","where":"@and(less(sub(item()['LastDayOfMonth'], item()['DayOfMonth']), 7), equals(item()['DayOfWeek'], 1))"},"runAfter":{"Select_Generate_Dates_Dataset":["Succeeded"]},"metadata":{"operationMetadataId":"7419c81d-ecc5-45f8-a8f5-89d9495a3765"}},"Compose_Next_last_Monday_of_The_Month":{"type":"Compose","inputs":"@body('Filter_array_All_Last_Mondays_of_The_Month')?[0]?['Date']","runAfter":{"Filter_array_All_Last_Mondays_of_The_Month":["Succeeded"]},"metadata":{"operationMetadataId":"5af898b2-9d3d-4217-9d85-1ea7509c9016"}},"Filter_array_Weekdays_Between_Two_Dates":{"type":"Query","inputs":{"from":"@body('Filter_array_Only_Weekdays')","where":"@and(greater(formatDateTime(item()?['Date']), formatDateTime('6/1/2030')), less(formatDateTime(item()?['Date']), formatDateTime('8/15/2030')))"},"runAfter":{"Compose_Next_Weekday_Date":["Succeeded"]},"description":"You must use formatDateTime( ) on all dates used in the filter conditional","metadata":{"operationMetadataId":"4891f496-c2ad-465c-9125-d035c907b146"}},"Compose_Number_of_Weekdays_Between_Two_Dates":{"type":"Compose","inputs":"@length(body('Filter_array_Weekdays_Between_Two_Dates'))","runAfter":{"Filter_array_Weekdays_Between_Two_Dates":["Succeeded"]},"metadata":{"operationMetadataId":"ae3b94e2-e842-4caa-960a-95af8b811243"}}},"runAfter":{},"metadata":{"operationMetadataId":"f2e29e4e-0a77-4b0e-9525-ff0334a2aeac"}}}