Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i have an input table like this:
Key1 | Key2 |
---|---|
A | 1 |
B | 2;3 |
C | 4;5;6 |
I need to create a table like this:
Key1 | Key2 |
---|---|
A | 1 |
B | 2 |
B | 3 |
C | 4 |
C | 5 |
C | 6 |
Which is the best way to achive the goal'
Many thanks!
Hi Romeo,
this script should work as aspected:
RawData:
LOAD * Inline [
Key1, Key2
A,1
B,2;3;4
C,4;5;6
];
Result:
LOAD
Key1 AS Res1,
SubField(Key2, ';', IterNo()) AS Res2,
RowNo() AS ResKey
Resident RawData
While SubStringCount(Key2,';') >= IterNo()-1
;
DROP Table RawData;
HtH
Roland
in your script, write this
LOAD
subfield(Key2,';') as Key2
Resident
Hi Romeo,
this script should work as aspected:
RawData:
LOAD * Inline [
Key1, Key2
A,1
B,2;3;4
C,4;5;6
];
Result:
LOAD
Key1 AS Res1,
SubField(Key2, ';', IterNo()) AS Res2,
RowNo() AS ResKey
Resident RawData
While SubStringCount(Key2,';') >= IterNo()-1
;
DROP Table RawData;
HtH
Roland