What is the best way to sort the list items

New Contributor

What is the best way to sort the list items

Hi All,

 

In which way we can sort the list items names and suggest me in an optimized way which wont increase the model size.

 

Thanks in advance!!

 

Regards,

Mahesh Kumar.

Message 1 of 9
8 REPLIES 8
Certified Master Anaplanner

Re: What is the best way to sort the list items

HI Mahesh,

 

My suggestion is to create a module with that list and create one line item with "Text" formatted and bring in the Name into that line item by writing Name(Item('')) if it is a normal list or Display Name.List if it is a numbered list. Then put Sorting on the above created line item either in Ascending or Descending order based on your requirement. Please have a quick look at the below screen shot.

 

Before SortingWhat is the best way to sort the list items.PNG

Sorting based on Line item "Name"What is the best way to sort the list items 1.PNG

 After sorting,

What is the best way to sort the list items 2.PNG

Let me know if you want any clarifications.

 

Thanks,
Kavin.

Message 2 of 9
New Contributor

Re: What is the best way to sort the list items

Thanks Kavin,

But if i a have more properties and the data is coming through other integrations.And after sorting in the module i need to import to the list.
But after some days if the list get updated with other names and again we need to run the import action again.
These way the model size increases more.
Is there any other way to sort the items in list.
Message 3 of 9
Certified Master Anaplanner

Re: What is the best way to sort the list items

HI Mahesh,

 

Try it in this way. 

Step 1: Create a List called "Alphabetical Order" and create all the 26 characters as a list items with code starts from 0 to 26. ( Note :This will be a one time actvity) You can use this for any list that needs to be sorted.

 

What is the best way to sort the list items 3.PNG

Step 2: Create a line item in your module(Would always prefer because of Model performance and don't create properties) and it should be number formatted. The module should have the dimension of the list that you needs to get it sorted. Then write the below formula and sort that accordingly (Basically create relation between your list and Alph.. List and convert that to number) .

 

Before sorting.

What is the best way to sort the list items 4.PNG

After sorting.

What is the best way to sort the list items 5.PNG

So in this way you can do your sorting permemantly without any increase in Model size as well. You can use that list "Alphabetaical Order" for whatever list that you want to sort.

 

Thanks and let me know if you have any concerns. I hope this would be helpful!! :)

 

Kavin.

Message 4 of 9
Occasional Contributor

Re: What is the best way to sort the list items

Hi Kavin,

 

I like the idea and it works neatly if you want it "loosely" sorted on alphabetical order.

 

However, in this solution, there's no "ranking bias" given to the second (and third, fourth etc.) letters - Sri Lanka appears above Sri Lanka.

 

I'm looking to get my head around a similar solution, but for alphanumerical list items (account IDs - "AC12354" etc.).

 

Does anyone have a thought on this?

Message 5 of 9
Occasional Contributor

Re: What is the best way to sort the list items

Hi 

You can add more formulas like this to rank to 3 letters:

 

VALUE(CODE(FINDITEM(Alpha Order, LEFT(Unique Employee.EmployeeName[LOOKUP: Employee Name], 1))) & CODE(FINDITEM(Alpha Order, MID(Unique Employee.EmployeeName[LOOKUP: Employee Name], 2, 1))) & CODE(FINDITEM(Alpha Order, MID(Unique Employee.EmployeeName[LOOKUP: Employee Name], 3, 1)))) / 100

Message 6 of 9
Highlighted
Community Boss

Re: What is the best way to sort the list items

@michael_park 

For performance, please split those component parts out into separate line items

 

Unique Employee.EmployeeName[LOOKUP: Employee Name] is repeated 3x

 

and you should split the parameters of the FINDITEM into separate line items too

 

David

 

Message 7 of 9
Occasional Contributor

Re: What is the best way to sort the list items

Quick question.

you said to repeat Unique Employee.EmployeeName[LOOKUP: Employee Name] x 3 times.

This formula will provide the same results 3 times so why do I need to do 3 times?

Message 8 of 9
Community Boss

Re: What is the best way to sort the list items

sorry for the confusion, I meant because it is repeated 3x in the formula, it should be split out into a single line item

David

Message 9 of 9