Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
puttemans
Specialist
Specialist

Invert content of a variable

Dear all,

I'm facing this issue where I really need a solution for.

I have a file containing an identifier (MORO-ID) and a route. This route is composed of a varying number of stationcodes, each time separated by a semicolon. For some of the MORO-ID's, I now need to invert the route. So given a route a;b;c;d;e;f;g this would need to become g;f;e;d;c;b;a

Could anyone give me a hint on how to tackle this?

(file attached)


1 Solution

Accepted Solutions
Anonymous
Not applicable

See the attached file,

Data:

Load

*,

100000000- rowno() as Seqno

Where len(REV_ROUTE_TEMP)>0

;

LOAD [MORO_ID           ] as MORO_ID,

     ROUTE,

     subfield(trim(ROUTE),';') as REV_ROUTE_TEMP

    

FROM

[MOBIB_ROUTE_2015.qvd]

(qvd);

Data2:

NoConcatenate

Load

MORO_ID,

';'&Concat(REV_ROUTE_TEMP,';',Seqno)&';' as REV_ROUTE

Resident Data

group by MORO_ID

;

drop table Data;

View solution in original post

3 Replies
jpenuliar
Partner - Specialist III
Partner - Specialist III

see below:

Reverse string

Anonymous
Not applicable

See the attached file,

Data:

Load

*,

100000000- rowno() as Seqno

Where len(REV_ROUTE_TEMP)>0

;

LOAD [MORO_ID           ] as MORO_ID,

     ROUTE,

     subfield(trim(ROUTE),';') as REV_ROUTE_TEMP

    

FROM

[MOBIB_ROUTE_2015.qvd]

(qvd);

Data2:

NoConcatenate

Load

MORO_ID,

';'&Concat(REV_ROUTE_TEMP,';',Seqno)&';' as REV_ROUTE

Resident Data

group by MORO_ID

;

drop table Data;

puttemans
Specialist
Specialist
Author

Hello Amarbogam,

Thank you for your solution. To me, it is really impressing. In just 20 seconds, all lines are inverted !

Thanks a lot !!