Lab 6. Task Overdue
Lab 6. Task Overdue
Task overdue
Learning objective: Controls, manipulation Excel, conditions, Date & time, expressions
Duration: 20 minutes
Scenario: We have an Excel document with a set of tasks, where some of these tasks are overdue. You will
create a Flow that will find all overdue tasks and will send a report of these tasks.
Tasks:
1. Create a new Excel file in your OneDrive for Business that looks like this (use the same columns).
Before adding data in the Deadline column, make sure it is in Text format (otherwise your flows
will crash!).
Task Status in charge Deadline
Feed the cat Started [email protected] 1/1/2021
Call jon Not Stared [email protected] 2/4/2021
Patch sql server Started [email protected] 7/6/2021
Call mum Started [email protected] 6/7/2021
Buy fruits Started [email protected] 8/8/2021
Call Kent Not Started [email protected] 8/8/2021
Buy a Porsche Done [email protected] 1/9/2021
a) Click Add:
Since a timestamp is in string format, the ticks expression returns the number of ticks (100
nanosecond intervals) since 1st January 1601. By using ticks, we can compare two different
timestamp values.
13. Rename the condition to Check if overdue to provide your Flow with more clarity:
14. Send an email (V2) to the person in charge of this task and fill in the e-mail properties as
following:
a. The To field should get the Excel in charge value
b. The Subject should be: “your task is overdue.”
c. The Body should be:
Using OData Filter (Filter query) is often considered as a good practice because the data are filtered on
server-side and that can make you Flow running faster by using fewer resources.
In some cases, filtering data in the Flow itself cannot be avoided. In this case, you can use the Filter Array
action instead of adding conditions.
Optional
Why did we switch the format of the Deadline column to Text? Because by default it is a number.
Indeed, if we switch the Deadline column type to General and if re-write (or just update) the data our next
flow run will generate an error:
Internally the Deadline field is now a number that give you the number of days between 1899-12-30 and
your specific date. The ticks() function expect a real date, so it fails here. It should be updated with:
ticks(addDays('1899-12-30',int(items(‘Apply_to_each’)['deadline'])))