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.
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 Sorting
Sorting based on Line item "Name"
After sorting,
Let me know if you want any clarifications.
Thanks,
Kavin.
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.
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.
After sorting.
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.
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?
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
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
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?
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
Hi,
You could use the alphabetical order give by the names using a text formatted Line item named Sort and a formula like:
Upper(Name(Item('List to be sorted')))
Use upper function to eliminate different ASCI codes of lower and capital letters.
If the list is multi level concatenate the Parents in the Sort line item in front of the level 0 element. below an example with 3 level list:
Upper( Parent(Parent(Name(Item('List to be sorted')))) & "_" & Parent(Name(Item('List to be sorted'))) & "_" & Name(Item('List to be sorted')) )
This way the order will be shown respecting the hierarchy and also the parents in the hierarchy will be ordered.