AL icon indicating copy to clipboard operation
AL copied to clipboard

Suggestion: Sort Function for List Datatype

Open marcosabotinski opened this issue 6 years ago • 2 comments

Hey everyone, I would suggest a build-in sort function for the AL List datatype.

Scenario: I collect dates from different records (of different tables) in a List of [Date] variable. After that I want to iterate over those dates chronologically.

Basic Example:

    local procedure ListExample()
    var
        listofDates: List of [Date];
    begin
        listofDates.Add(20190501D);
        listofDates.Add(20190101D);
        listofDates.Add(20190301D);
        listofDates.Sort();
    end;

The sort function could have an optional ascending : Boolean parameter to control the sorting. For now I can create one on my own but on long term I would prefer a build-in standardized and optimized function.

Thanks a lot

marcosabotinski avatar Jan 28 '19 15:01 marcosabotinski

HI @marcosabotinski thank you for reporting the suggestion, it make sense. I mark it as enhancement and we'll consider to include it in future updates.

AndreyKorepanov avatar Jan 29 '19 10:01 AndreyKorepanov

Is this issue still being tracked? Would be really helpful otherwise you'd be stuck to the creation of temp tables and sorting the inserted values via Ascending(true/false) or implement a sorting algorithm i.e. QuickSort or BubbleSort...

Best regards

MichaelSchauer98 avatar Feb 22 '23 15:02 MichaelSchauer98