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

Condition to compare times

Good day.

 

I'm building a flow which triggers when a file is created or modified in a SharePoint library and then sends an email. I added a condition to compare the file created time with the file modified time so I can send different emails depending on the outcome. If time created equals time modified it means its a new file, if time created does not equal time modified it means the file is an existing file which has been modified but no matter if I upload a new file or edit an existing one, the result is always false and I cant understand why

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

@Jacques19 

Please use the below expression in your Left hand side of your expression this gets the date difference in minutes

div(div(mul(sub(ticks(triggerOutputs()?['body/Modified']),ticks(triggerOutputs()?['body/Created'])),100),1000000000),60)
 
So if less than or equal 0 then it is create otherwise it is update? Hope this makes sense!
Mira_Ghaly_0-1601021921518.png

 

 

 

 
 

 

 

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

View solution in original post

8 REPLIES 8
Highlighted
Resident Rockstar
Resident Rockstar

@Jacques19  can you please add a screen shot of your condition?

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.
Highlighted

@Jacques19 

I made a test on my side on record created the difference between modified and created is seconds as shown below that's why your flow always evaluate to false

Mira_Ghaly_0-1601019985665.png

 

 

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.
Highlighted

This what I did. Also note I am new to flow and im using android.

Not sure how ro implement your screenshots. Im using this website on my phone and not seeing a button to add a screenshot

Highlighted

I originally created a separate flow just with the when file modified trigger but if I use that trigger, the flow triggers when a file is created too even though its description clearly states it does not trigger when new files are created.

Highlighted

Managed to upload a screenshot

 

Screenshot_20200925_095103_com.microsoft.flow.jpg

 

Highlighted

@Jacques19 

Please use the below expression in your Left hand side of your expression this gets the date difference in minutes

div(div(mul(sub(ticks(triggerOutputs()?['body/Modified']),ticks(triggerOutputs()?['body/Created'])),100),1000000000),60)
 
So if less than or equal 0 then it is create otherwise it is update? Hope this makes sense!
Mira_Ghaly_0-1601021921518.png

 

 

 

 
 

 

 

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

View solution in original post

Highlighted

Your screenahot looks very different to what I see on my screen. I cannot set only the left expression. I can only add 1 expression for both sides unless I just dont know how. Like I said. Im totally new to this. Started using this app yesterday

Highlighted

Just figured out how to implement your sollution. Working 100% now. Thank you so much!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (316)