• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Generate an xml file from csv with header and positin in one file

#1 2012-06-15 11:14:42

wulf
Member
Registered: 2011-02-09
Posts: 38

Generate an xml file from csv with header and positin in one file

Hallo togehter i have still a problem with an csv file.
The csv file includes about 40 Columns. The rows are qualified in the first column as header or position. I have to create an xml file from the csv file.

"KS","21100","Kreditor","6912","debitor",","","Vincenzstraße 29","","","","65719","Hofheim","D","EUR"
"PS","10","24030","38.00","kg","ST","1.0000","5.870","1","24.05.2012","07:00:00","14:00:00"
"PS","20","408002","3.00","ST","KT","30.0000","19.500","1","24.05.2012","07:00:00","14:00:00"

<rootTag>
  <KundenNr>6912</KundenNr>
  <Kundenname1>Vincenzstraße 29</Kundenname1>
  <Bestellnummer>14</Bestellnummer>
  <position>
    <BestPos>10</BestPos>
    <LieferantenArtNr>24030</LieferantenArtNr>
    <Menge>1.0000</Menge>
    <MengenEh>ST</MengenEh>
    <LiDat>24.05.2012</LiDat>       This is the problem !! i need the Information LiDate from the position row (in every position the same Date) one time in the header.
  </position>
  <position>

Offline

#2 2012-06-15 11:23:44

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: Generate an xml file from csv with header and positin in one file

Hi

Hope I catch your point.

<rootTag>
  <KundenNr>6912</KundenNr>
  <Kundenname1>Vincenzstraße 29</Kundenname1>
  <Bestellnummer>14</Bestellnummer>
   <LiDat>24.05.2012</LiDat>     //<------you want it here?
  <position>
    <BestPos>10</BestPos>
    <LieferantenArtNr>24030</LieferantenArtNr>
    <Menge>1.0000</Menge>
    <MengenEh>ST</MengenEh>
   
  </position>
  <position>

Why don't you use tFileOutputMSXML and extract LiDat separately?
Or use tJavaRow to add a new column in KS row.

Regards,
Pedro


Only Paranoid Survive.

Offline

#3 2012-06-15 11:48:00

wulf
Member
Registered: 2011-02-09
Posts: 38

Re: Generate an xml file from csv with header and positin in one file

Yes i want it there.
But what do you mean
"Why don't you use tFileOutputMSXML and extract LiDat separately?"

Is there a differenz between tAdvancedfileoutputxml an tFileoutputMSXML ?

I made an output Schema complete with all possible columns and fill in needed fields with for example

Test.iff(row6.Column0, "KS", row6.Column1, "")   for an information from the header column Like customer number

Test.iff(row6.Column0, "PS", row6.Column9, "")   for an information from the position column Like LiDat

Offline

#4 2012-06-15 12:29:57

wulf
Member
Registered: 2011-02-09
Posts: 38

Re: Generate an xml file from csv with header and positin in one file

Here is my tMap and my xml output

So i defiened all available columns in the output schema and filled with csv fields depending on Header or positin qualifier.
In xmloutput for example LiDat is not filled for root segment.
My idea was to fill an variable while reading only the first positional row and catch the LiDat to read the variable while fill the xml file.


Uploaded Images

Last edited by wulf (2012-06-15 12:47:41)

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Generate an xml file from csv with header and positin in one file

Board footer

Powered by FluxBB