Sorting of IDs in a lookup field
I am fetching IDs of records into a collection and sorting out the IDs according to the date field related to each ID.
For example
ID, Date
12345, 18 Nov
12346, 14 Nov
12347, 12 Nov
12348, 15 Nov
by sorting according to date, I can get the collection of ID to show in the below sequence
ID, Date
12347, 12 Nov
12346, 14 Nov
12348, 15 Nov
12345, 18 Nov
However, when I want to add this collection into a lookup field, the IDs are rearranged back into its original sequence (in running order sequence)
12345
12346
12347
12348
Real example of what I am doing below:
all_expenses = (Expenses[Date_of_Purchase <= input.Date_pf_Purhase_On_Before].ID sort by Date_of_Purchase).getAll()
Using the above script, I sort the IDs by date.
When I "info" the collection, I am to rearrange the IDs, as below
However, when I input the IDs into the lookup field by using the script input.Expenses_lookup = all expenses, the IDs rearranges themselves back according to running order of numbers.
Can anyone advise me how can I sort the the IDs in the lookup field according to the sequence I want?
Thanks alot!