Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Talk to Experts Tuesday, Live Q&A, September 22: Moving from QlikView to Qlik Sense. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

sort alphabetically characters within a field

is it possible, in the process of loading data, sort alphabetically characters within a field (alphanumeric)?

12 Replies
Highlighted

Yes, you should be able to use order by to sort a text field

Highlighted
Not applicable

I apologize for not having properly explained. I would do this:

"ADC130" -> "013ACD"

for each occurrence of the field

Highlighted
Master
Master

=keepchar(yourfield,'0123456789')&purgechar(yourfield,'0123456789')

Highlighted

This alone will not work because ADC -> ACD and 130 -> 013

May be using SubField() and then Concat()

Highlighted
Master
Master

Sorry yes my misunderstanding of the requirement

Highlighted
Creator II
Creator II

Hi,

The only solution i see is to make, for each character you have in your field the following function and concatenate, like below:

IF(SubStringCount(Test,IF(SubStringCount(Test,0)<>0,Repeat('1',SubStringCount(Test,1)))1)<>1,Repeat('1',SubStringCount(Test,1)))&...&IF(SubStringCount(Test,'A')<>0,Repeat('A',SubStringCount(Test,'A')))


I can not figure out how to use a loop to not have to insert with concatenation.

Best regards,

Cosmina

Highlighted
MVP
MVP

Maybe something like

LOAD In, RecId, Concat(Char) as Out

GROUP BY In, RecId;

LOAD *, Recno() as RecId,

  Mid(In,Iterno(),1) as Char

WHILE iterno() <= Len(In);

LOAD * INLINE [

In

"ADC130"

];

Highlighted
Master
Master

This is awesome, but how does it sort... I just can't get my brain to process it!

Highlighted

If you don't provide a sort order to the Concat, it will sort by the ascending order