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

Check if dates are in chronological order in a collection

Team,
I have a problem and I would like to ask for your help:
I need to check that the dates in a collection are in chronological order (only when STATUS column is COMPLETED) and, if not, set a variable to "false".
My collection has 3 columns, as in the example below:
 
ORDERDATESTATUS

1

01/02/2020Completed
203/02/2020Completed
307/02/2020Completed
405/02/2020Completed
509/02/2020Completed
6 Awaiting
7 Awaiting

Thank you very much for any help you can give me.
3 REPLIES 3
Highlighted
Community Support
Community Support

Re: Check if dates are in chronological order in a collection

@pquateli 

 

What is the data source and what is the type of Status columns?

 

If the Status is text column, please try this, put the codes to button OnSelect:

 

Clear(Result);ForAll(Filter('Table',STATUS="Completed"),Collect(Col_LoopNo,1);If(Last(FirstN(Filter('Table',STATUS="Completed"),CountRows(Col_LoopNo))).DATE=Last(FirstN(SortByColumns(Filter('Table',STATUS="Completed"),"DATE1",Ascending),CountRows(Col_LoopNo))).DATE,Collect(Result,true),Collect(Result,false)));If(false in Result.Value, Set(VariableName, false))

 

If dates in a collection are not in chronological order, it will set false to the variable.

Sik

Highlighted
Frequent Visitor

Re: Check if dates are in chronological order in a collection

Thanks Sik, I'll try.

Original data is in SharePoint list and Status column is text.

Highlighted
Community Support
Community Support

Re: Check if dates are in chronological order in a collection

Hi @pquateli 

 
How about your issue?
Does the workaround above suit for your case?
Sik

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (8,291)