Page 1 of 1

Parsing a string into multilple columns

Posted: Wed Nov 30, 2011 7:41 pm
by chida25
Hi
Input is a delimited file as below

KEY_COL|ATTRIBUTE_NAME_2|ATTRIBUTE_VALUE_4
sonj2|USER PRIVILEGES DESC|useradmin+route+suppress+reportadmin

Expected output- wants to create multiple rows for each KEY_USER according to attribute values associated with it.

KEY_COL ATTRIBUTE_NAME_2 ATTRIBUTE_VALUE_2
sonj2 USER PRIVILEGES DESC useradmin
sonj2 USER PRIVILEGES DESC route
sonj2 USER PRIVILEGES DESC suppress
sonj2 USER PRIVILEGES DESC reportadmin

Used column import and pivot stage to achieve, output result. However can exist more or less for other KEY_USER, this dynamic part is becoming limitation.Is there any way to handle this dynamic part?

Used Field and Index function but how to increase the counter of delimiter position?

Used Convert function and CHAR(10) but the result is in one row.

Posted: Wed Nov 30, 2011 7:48 pm
by ray.wurlod
Assuming you're on version 8.5 or later, use a loop in the Transformer stage to output a row for each "+"-delimited field in the ATTRIBUTE_VALUE_4 column.

Posted: Wed Nov 30, 2011 8:34 pm
by chida25
Thanks for response, however
Still in 8.1.
Please suggest any other alternative.

Posted: Wed Nov 30, 2011 9:59 pm
by ray.wurlod
1. Process the maximum possible number of fields and output only if the result is non-empty.

2. Use a server job and take advantage of the dynamic normalization characteristic of hashed file or UniVerse table.

3. Upgrade to version 8.5 or later.