I need help with a flow. I am getting the time stamp from an email and I want to have Flow determine if its morning, afternoon, evening, afterhours and put that text in a cell on spreadsheet with other data. Example 2:05 PM should = Afternoon.
Time frame and Text to Place in spreadsheet
12:00 AM to 7:59 AM = "Afterhours"
8:00 AM to 11:59 AM = "Morning"
12:00 PM to 4:59 PM = "Afternoon"
5:00 PM to 10:00 PM = "Evening"
10:01 PM to 11:59 PM = "Afterhours"
I think I can do this with a condition but am at a loss.
Solved! Go to Solution.
I actually found my solution. @ScottShearer posted on another similar issue. However I needed to make the variable an type "integer" then it started working. Thank You Scott Shearer.
Hello @BrianHarmon
With 4 simple variable actions, you can get the needed period for your use.
Variable action 1: Name = Hour, Type = Integer, Value = expression sub(int(formatDateTime(utcNow(),'HH')),1)
This variable will hold a value from 0 to 23 from the datetime that you provide - I use utcNow() above - swap with your datetime field.
Variable action 2: Name = HourToPeriod, Type = Array, Value = [0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,3,3,3,3,3,0,0]
This variable holds an array of 24 numbers, where 0 represents Afterhours ... and so forth.
Variable action 3: Name = PeriodToText, Type = Array, Value = expression createArray('Afterhours','Morning','Afternoon','Evening')
This variable holds the names of the periods.
Variable action 4: Name = PeriodName, Type = String, Value = expression first(skip(variables('PeriodToText'),first(skip(variables('HourToPeriod'),variables('Hour')))))
This variable convert the Hours into a Period and then into the Name.
Kind regards, John
I actually found my solution. @ScottShearer posted on another similar issue. However I needed to make the variable an type "integer" then it started working. Thank You Scott Shearer.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
45 | |
16 | |
15 | |
14 | |
13 |
User | Count |
---|---|
78 | |
40 | |
28 | |
22 | |
19 |