Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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)
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;
see below:
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;
Hello Amarbogam,
Thank you for your solution. To me, it is really impressing. In just 20 seconds, all lines are inverted !
Thanks a lot !!