Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
sunny_talwar

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

Not applicable
Author

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

"ADC130" -> "013ACD"

for each occurrence of the field

adamdavi3s
Master
Master

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

sunny_talwar

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

May be using SubField() and then Concat()

adamdavi3s
Master
Master

Sorry yes my misunderstanding of the requirement

Anonymous
Not applicable
Author

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

swuehl
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"

];

adamdavi3s
Master
Master

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

sunny_talwar

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