Sorting Dates
  • 12 Mar 2021
  • 1 Minute to read
  • Dark
    Light

Sorting Dates

  • Dark
    Light

Article summary

Example Lab Article
While Example Lab projects are resources for public use, articles and assets are not actively maintained. Screenshots and features are from the specified version below. These references may become dated as new versions are released.


Overview

Example Lab Details

Version6.10.1
Root FolderExample Lab - Sorting Dates
Modules None
DependenciesNone

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'.

Reference Articles


Main Flow


Collection Sort Step Logic


Merging a list of strings logic


Project Download

The examples attached were developed to be instructional and were not developed as officially supported components. For more information or to engage our service team to develop fully supported, production quality solutions, please contact services@decisions.com. Import the project below to a Decisions environment on version 6.10.1 or later using our Importing/Exporting article.





Was this article helpful?