- 12 Mar 2021
- 1 Minute to read
- Print
- DarkLight
Sorting Dates
- Updated on 12 Mar 2021
- 1 Minute to read
- Print
- DarkLight
Overview
Example Lab Details | |
Version | 6.10.1 |
Root Folder | Example Lab - Sorting Dates |
Modules | None |
Dependencies | None |
This Example Lab project demonstrates how to sort a list of dates and have the Flow export the most recent date.
Explanation
The Flow works by sorting the list of dates and then selecting the first item in the sorted list as the most recent date.
The Flow called 'Sort Flow List' uses a Collection Sort step that receives two inputs (first date/second date) and performs logic to sort a list of dates. These inputs are then evaluated by the Rules throughout the Flow. The first Rule determines if the first data is less than the second date. If the Rule returns true, then the second date is sorted first. If it is false, the dates are passed onto the next Rule to determine if the dates are the same.
If the dates are the same, the Rule returns true and the two dates are sorted accordingly. If the dates are different, the Rule returns false and the first data is sorted first. The original and sorted list of dates is then shown side-by-side in a Form with the most recent date isolated in a separate textbox. The most recent date will then be passed on as the output of the Flow when the Form is closed. To test the project, either run the 'Main Flow' and input a list of dates, or open the Flow editor and run the unit test in the debugger titled 'Example Dates List'.
Main Flow
Collection Sort Step Logic
Merging a list of strings logic