Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting chars in a string.

Hi guys,

I´m trying to find a solution to do a sort inside the string, but I´m newbie in Qlik and I don´t know how to solve this problem.

I´m using Qlikview 12 Personal Edition.

Example: Imagine a table, where exist a field called "Name". Now, I want to create an expression that take every string in the "Name" field and do a sort in it as "Name_Sorted". Please, look at the table below.

NameName_Sorted
josepejops
johnhjno
mariaaaimr
fedcbaabcdef

Any suggestions on how to do this?

Thank you and sorry for my english.

Diego

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe

LOAD RecId, Concat(Char) as Sorted,

  Name

GROUP BY RecId,Name;

LOAD Mid(Name,iterno(),1) as Char,

  Iterno() as Index,

  Recno() as RecId,

  Name

WHILE iterno() <= Len(Name);

LOAD Name

FROM

[https://community.qlik.com/thread/233512]

(html, codepage is 1252, embedded labels, table is @1);

View solution in original post

2 Replies
swuehl
MVP
MVP

Maybe

LOAD RecId, Concat(Char) as Sorted,

  Name

GROUP BY RecId,Name;

LOAD Mid(Name,iterno(),1) as Char,

  Iterno() as Index,

  Recno() as RecId,

  Name

WHILE iterno() <= Len(Name);

LOAD Name

FROM

[https://community.qlik.com/thread/233512]

(html, codepage is 1252, embedded labels, table is @1);

Not applicable
Author

Hi Stefan,

It worked great.

Thank you.