Page 1 of 1

column import

Posted: Thu May 01, 2008 5:15 pm
by just4u_sharath
i have the data like
Field1
aaaaaaa
bbbbbbb
cccccccc
ddddddd
eeeeeee.
Now i have to split this field1 to field 2 and filed 3
where filed2 should contain the 1st 3 chars and field3 should contain the last 4 chars. I can do this using a transformer. But i wish to use column import. Can i split the record using column import stage eventhough the input filed doesnt have a DELIMITER.

Posted: Thu May 01, 2008 5:33 pm
by jhmckeever
Nope.

What's the attraction to the Column Import stage? Don't get me wrong, it's a great stage - It's got a pretty cool icon too! Do you subscribe to the 'transformers are expensive and to be avoided unless absolutely necessary' ethos? Many people do.

If you want to avoid a transformer you could try a Modify stage which would derive 2 new output columns using the substring function:

Code: Select all

string = substring[start,length](string)
E.g.

Code: Select all

field2:string = substring[1, 3](field1)
field3:string = substring[4, 4](field1)
(That's off the top of my head - no warranty implied!)

J.

Posted: Thu May 01, 2008 5:39 pm
by ray.wurlod
:!:
Modify stage uses zero-based counting.

Nothing wrong with Transformer stages (these days) either.

Posted: Thu May 01, 2008 9:44 pm
by just4u_sharath
ray.wurlod wrote::!:
Modify stage uses zero-based counting.

Nothing wrong with Transformer stages (these days) either.
I can get this funtionality using transformer. But i want to know the functionality of column import. Will it split the data if the data doesnt have any delimiters. Just learning the functionlaity of column import stage.

Posted: Fri May 02, 2008 4:08 am
by dsusr
Column import will work fine in your case. Just define the schema as Fixed length file with no delimiter.

dsusr