Sorting of IDs in a lookup field

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!




                            Zoho Desk Resources

                            • Desk Community Learning Series


                            • Digest


                            • Functions


                            • Meetups


                            • Kbase


                            • Resources


                            • Glossary


                            • Desk Marketplace


                            • MVP Corner


                            • Word of the Day



                                Zoho Marketing Automation


                                        Manage your brands on social media



                                              Zoho TeamInbox Resources

                                                Zoho DataPrep Resources



                                                  Zoho CRM Plus Resources

                                                    Zoho Books Resources


                                                      Zoho Subscriptions Resources

                                                        Zoho Projects Resources


                                                          Zoho Sprints Resources


                                                            Qntrl Resources


                                                              Zoho Creator Resources


                                                                Zoho WorkDrive Resources



                                                                  Zoho Campaigns Resources

                                                                    Zoho CRM Resources

                                                                    • CRM Community Learning Series

                                                                      CRM Community Learning Series


                                                                    • Tips

                                                                      Tips

                                                                    • Functions

                                                                      Functions

                                                                    • Meetups

                                                                      Meetups

                                                                    • Kbase

                                                                      Kbase

                                                                    • Resources

                                                                      Resources

                                                                    • Digest

                                                                      Digest

                                                                    • CRM Marketplace

                                                                      CRM Marketplace

                                                                    • MVP Corner

                                                                      MVP Corner

                                                                    





                                                                    




                                                                        Design. Discuss. Deliver.

                                                                        Create visually engaging stories with Zoho Show.

                                                                        Get Started Now