Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
hanskaman
Contributor
Contributor

Sort order

Hello,

I have a table that has the following content:

Articlenumber

02010

04405

VE12345

19200

02012HT

I want to sort this on Articlenumber and expect the following order:

02010

02012HT

04405

19200

VE12345

The result that I actually get is:

02012HT

VE12345

19200

04405

02010

What can I do to get the wanted sort order?

 

 

1 Solution

Accepted Solutions
Kushal_Chawda

@hanskaman  In table properties, Sorting option for that dimension select sort by measure and put below expression

=rank(Articlenumber)

You can select ascending/descending based on your requirement

 

View solution in original post

7 Replies
rubenmarin

Hi, have you tried to load it alphabetically? Select the object, go the properties on the right side, expand sort, disable auto, and disable all options but alphabetical

hanskaman
Contributor
Contributor
Author

Yes I tried that, no success.


MayilVahanan

Hi Hanskaman,

Try with Dual() function if its only few articles and sort based on the number

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
rubenmarin

Hi, I tried and it didn't sort correctly initially because some values were loaded as number and others as text, if you convert all to text (using LOAD Text(Articlenumber) as Articlenumber...) it shows as expected:

rubenmarin_0-1626679082689.png

Another option can be sorting as expression using the ascii values with an expression like:

Ord(Left(Articlenumber,1))&Ord(Mid(Articlenumber,2,1))&Ord(Mid(Articlenumber,3,1))&Ord(Mid(Articlenumber,4,1))...

Using this kinf of expression will need some adjuntementes if there are lowercase or other symbols in codes,a lso ther is a limit in the length of the number generated.

 

hanskaman
Contributor
Contributor
Author

Thank you for your answer. I tried the option with LOAD Text(articlenumber,….)

At first look this was not correct. Then I made a new Visualisation (Table) and suddenly the results are a lot better.

 

But…. I still have ca. 3 articlenumbers that show up in a strange order:

 

09810SKL

09815SKL

09825SKL

09828SKL

09830SKL

09855SKL

09860SKL

09870SKL

09880SKL        

09895SKL

09895SKLZO

09900HZ

09922HZVZ

09929HZ

09980HZ

09992HZ

19002DIVHT

19055

19065

19075

21200

098260HK

098274HK

098280HK

VE11010BR

VE11015BR

VR09740BR

 

I expected the yellow marked lines after the red marked line.

 

Greetings,

 

Hans Kaman

 

Kushal_Chawda

@hanskaman  In table properties, Sorting option for that dimension select sort by measure and put below expression

=rank(Articlenumber)

You can select ascending/descending based on your requirement

 

rubenmarin

I can't tell you why, for me this is a bug, as a workaround you can use both options I proposed:

- 1st sort by expression using (you can add an upper or use a field with all uppercase)

 Ord(Left(Articlenumber,1))&Ord(Mid(Articlenumber,2,1))&Ord(Mid(Articlenumber,3,1))&Ord(Mid(Articlenumber,4,1))

- Then also add the option to sort alphabetically