Page 1 of 1

how to convert a one column input to multiple column

Posted: Wed Feb 04, 2015 1:05 am
by ashokkumarss
hi i have situation like below.
I/P
NAME
ssak

O/P

NAME
s
s
a
k

how do i do this.. pls guide me..

Posted: Wed Feb 04, 2015 1:43 am
by prasson_ibm
When is the interview?

Re: how to convert a one column input to multiple column

Posted: Wed Feb 04, 2015 2:14 am
by ashokkumarss
already attended.. and myself also need to get clarification on this.. how to do it transformers.. if other languages like c, cpp worked.. but not in ds.. pls dont tease me, if possible clarify ..

Posted: Wed Feb 04, 2015 2:31 am
by prasson_ibm
Hi,

Please let us know what was your approach to get the output.

Re: how to convert a one column input to multiple column

Posted: Wed Feb 04, 2015 2:38 am
by ashokkumarss
its its multiple columns to multiple rows, instead of pivot stage i will use transformers and use loop variable and do that..

or else, if the input was like s,s,a,k.. then i use str function and its possible to split

but here, im little bit confused

or in the tension i may unable to find out the solution.. pls guide me in this situation..

i need guidance to solve this kind of inputs...

Posted: Wed Feb 04, 2015 6:16 am
by ArndW
This is a good place to use the loop functionality in a Transform stage.

In the Loop While condition put in "@ITERATION <= LEN(InColumn.InputString)"

Then in the Output just specify "InColumn.InputString[@ITERATION,1]" to put one character per row

Posted: Wed Feb 04, 2015 3:25 pm
by ray.wurlod
What's the business case behind the requirement? That may assist in deciding the most appropriate algorithm - there are at least five different ways to solve this one.

Re: how to convert a one column input to multiple column

Posted: Fri Feb 06, 2015 12:19 am
by ashokkumarss
got the idea how to do it.

get the input in stage variable
len(inputcol) = stagevariabl

looping

@iteration = stagevariable

right(left(inputcol,@iteration),1) - loopvar

loopvar - O/P

with guidance through my friend.

Posted: Mon Mar 02, 2015 2:29 am
by oracle
prasson_ibm wrote:When is the interview?
Learn from Ray,andrw how they responded...don't discourage if some one genuinely wants to learn.