Page 1 of 1

Concatenating multiple lines into one line using loop

Posted: Fri Jul 08, 2011 12:52 am
by Suman
Hi All,
Below is the scenario which we are trying to do using loop in 8.5 version. The functionality is achieved already using stage variables. We are looking for doing this in loop if possible.

Input File
PrimaryKey Data1
Pkey Data2
Pkey Data3
Pkey1 Data1
Pkey1 Data2
Pkey1 Data3

Output we want like this:
Pkey Data1PkeyData2PkeyData3
Pkey1Data1Pkey1Data2Pkey1Data3

Using the previous and current Pkey value can this be achieved through loop. We need if it is feasible or not using loop condition and variable.

Regards,
Suman

Posted: Fri Jul 08, 2011 6:30 am
by chulett
Yes. What have you tried?

Posted: Sat Jul 09, 2011 9:01 am
by Suman
We tried with CurrPk=PrevPk in the loop condition and defining the PrevPK and CurrPk as stage variables and then defining a Loop Variable LoopVar to concatenate each recored with the previous concatenated value that is stored in the LoopVar. But, the loop is executed infinite times. Same thing is working in stage variables using key break logic.

Regards,
Suman