Four Stars

(newcomer) Remembering last line content to build next line

Hello,
I am a newcomer (actually builing my first job) and I have a question.

First I am trying to generate a json (or xml) from the CSV below:


col1        col2       col3       col4  col5   col6

GARBAGE   , whatever1
YCSETTINGS, FFUND    , Discount , Tag1, 42286, USD
YCPOINT   , FFUND    , OVERNIGHT, O/N , 0.03
YCPOINT   , FFUND    , DEPOSIT  , 1M  , 0.04
YCPOINT   , FFUND    , DEPOSIT  , 2M  , 0.05

 

GARBAGE   , whatever2

YCSETTINGS, EONIA    , Discount , Tag2, 42287 ,EUR
YCPOINT   , EONIA    , OVERNIGHT, O/N , 0.03
YCPOINT   , EONIA    , DEPOSIT  , 6M  , 0.04
YCPOINT   , EONIA    , SWAP     , 9M  , 0.05


My problem is that lines where col1 is YCPOINT are relating to the above last occurence of a line where col1 is YCSETTINGS
At the end of the day I want to generate something like:

 

<DISPATCH_DOCUMENT>
  <CURVE ID="FFUND" TYPE="Discount" TAG="Tag1", DATE=42286, CCY="USD">
    <TERM ID="OVERNIGHT" EXP="O/N" VALUE=0.03/>
    <TERM ID="DEPOSIT"   EXP="1M"  VALUE=0.04/>
    <TERM ID="DEPOSIT"   EXP="2M"  VALUE=0.05/>
  </CURVE>

  <CURVE ID="EONIA" TYPE="Discount" TAG="Tag2", DATE=42287, CCY="EUR">
    <TERM ID="OVERNIGHT" EXP="O/N" VALUE=0.03/>
    <TERM ID="DEPOSIT"   EXP="6M"  VALUE=0.04/>
    <TERM ID="SWAP"      EXP="9M"  VALUE=0.05/>
  </CURVE>
</DISPATCH_DOCUMENT>

 

I don't know how to shape that....
Just let me know the kind of 'object' you beleive I should use (TMap, TFilter,..)
I guess that some 'variables' should be used somewhere...

Thank you vm !

  • Data Integration
1 REPLY
Moderator

Re: (newcomer) Remembering last line content to build next line

Hello,

For your job requirement, here is a component TalendHelpCenter:tXMLMap

which is used to transform and route data from single or multiple sources to single or multiple destinations.

 

 The work flow should be:tfileinputDelimited-->tXMLMap(transform data into XML mapping)-->tFileOutputXML(generate XML)

Best regards

Sabrina

 

 

 

 

 

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.