Skip to main content
Announcements
New: No-code data prep in Qlik Cloud Analytics™ TAKE A TOUR
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Ranking strings alphabetically

Hello guys i've faced with a sorting problem. I have a table which consists of 2 fields: first one is about names, another one - IDs. Gotta make up a way how to make additional field in this table by which i could sort IDs.

For instance , heres the table:

Data1:

LOAD * INLINE [

FIELD1, FIELD2

Moscow, ID1

Anapa, ID2

Paris, ID3

Rio, ID4

Beijing, ID5

];

Need to add one more field so as the result i could have smt like this

FIELD1,    ID,      SORT

Moscow,    ID1,       3

Anapa,       ID2,       1

Paris,         ID3,       4

Rio,            ID4,       5

Beijing,       ID5,       2

SORT field shows numbers of how those names from FIELD1 would go in alphabetical ORDER

1 Solution

Accepted Solutions
sunny_talwar

Try this:

Table:

LOAD * INLINE [

FIELD1, FIELD2

Moscow, ID1

Anapa, ID2

Paris, ID3

Rio, ID4

Beijing, ID5

];

FinalTable:

LOAD *,

  AutoNumber(FIELD2) as SORT

Resident Table

Order By FIELD1;

DROP Table Table;

View solution in original post

1 Reply
sunny_talwar

Try this:

Table:

LOAD * INLINE [

FIELD1, FIELD2

Moscow, ID1

Anapa, ID2

Paris, ID3

Rio, ID4

Beijing, ID5

];

FinalTable:

LOAD *,

  AutoNumber(FIELD2) as SORT

Resident Table

Order By FIELD1;

DROP Table Table;