Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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
MVP
MVP

Re: Sorting chars in a string.

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);

2 Replies
MVP
MVP

Re: Sorting chars in a string.

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

Re: Sorting chars in a string.

Hi Stefan,

It worked great.

Thank you.

Community Browser