Hi,
I have achieved your requirement in the following way
Job Design:
Code: Select all
InputFile----->TransformerA----->InterMediateFile------->TransformerB----->OutputFile
InputFile:
I am reading the input data in a Single Column say Field1
TransformerA
Declaring 2 stage variables in TransformerA
StageVar=Count(DSLink2.Field1,',')
StageVar1=Str(DSLink2.Field1:char(13):char(10), StageVar+1)
Output Derivation for Intermediate File:
I am writing only one field to the InterMediateFile
Field1=Trim(StageVar1,char(10),"T")
TransformerB
Declaring 3 stage variables in TransformerA
StageVar=RowProcCompareWithPreviousValue(Field(DSLink3.Field1,',',1))
Initial Value of StageVar1=1
StageVar1=If StageVar=1 then StageVar1+1 else 1
StageVar2=Field(DSLink3.Field1,',', StageVar1)
Output Derivation for Output File:
Field1=DSLink3.Field1:'$': StageVar2
Testing with Input:
Code: Select all
222,333,4444
235, 5644,453
423,8576,764,353
764,431,533
IntermediateFile:
Code: Select all
222,333,4444
222,333,4444
222,333,4444
235, 5644,453
235, 5644,453
235, 5644,453
423,8576,764,353
423,8576,764,353
423,8576,764,353
423,8576,764,353
764,431,533
764,431,533
764,431,533
Output File:
Code: Select all
222,333,4444$222
222,333,4444$333
222,333,4444$4444
235, 5644,453$235
235, 5644,453$ 5644
235, 5644,453$453
423,8576,764,353$423
423,8576,764,353$8576
423,8576,764,353$764
423,8576,764,353$353
764,431,533$764
764,431,533$431
764,431,533$533
Hope this helps