Hello,
I'am a beginner with cloverETL, and as evaluation, I wanted to try some simple exemple.
This is my first problem : I have a csv file, say InputFile.csv. In that file, the lines have this format :
8<-----------------
field1;field2;field3;field4
8<-----------------
And I want to copy this file to OutputFile.csv but without the third field :
8<-----------------
field1;field2;field4
8<-----------------
I thougth than some standard component could solve this problem, so I search in doc and components Java API, but I didn't find anything.
So I think I could use some kind of Reformat component, could I ?
If this is the solution, which metadata have I to put, on which edge ?
Is it something like that :
8<-----------------
<Graph>
<Global>
<Metadata id="InMetadata">
<Record name="Employees" type="delimited">
<Field name="field1" type="string" delimiter=";"/>
<Field name="field2" type="string" delimiter=";"/>
<Field name="field3" type="string" delimiter=";"/>
<Field name="field4" type="string" delimiter=";"/>
</Record>
</Metadata>
<Metadata id="OutMetadata">
<Record name="Employees" type="delimited">
<Field name="field1" type="string" delimiter=";"/>
<Field name="field2" type="string" delimiter=";"/>
<Field name="field4" type="string" delimiter=";"/>
</Record>
</Metadata>
</Global>
<Phase number="0">
<Node id="INPUT1" type="DELIMITED_DATA_READER_NIO" fileURL="InputFile.csv" DataPolicy="Strict" />
<Node id="SELECT_FIELD" type="???????" />
<Node id="OUTPUT1" type="DELIMITED_DATA_WRITER_NIO" fileURL="OutputFile.csv" DataPolicy="Strict" />
<Edge id="INEDGE1" fromNode="INPUT1:0" toNode="SELECT_FIELD:0" metadata="InMetadata" />
<Edge id="INNEREDGE1" fromNode="BROADCAST:0" toNode="OUTPUT1:0" metadata="OutMetadata" />
</Phase>
</Graph>
8<-----------------
Any help is appreciated.
Thanks in advance (and excuse me for my ugly english)
Francois
I'am a beginner with cloverETL, and as evaluation, I wanted to try some simple exemple.
This is my first problem : I have a csv file, say InputFile.csv. In that file, the lines have this format :
8<-----------------
field1;field2;field3;field4
8<-----------------
And I want to copy this file to OutputFile.csv but without the third field :
8<-----------------
field1;field2;field4
8<-----------------
I thougth than some standard component could solve this problem, so I search in doc and components Java API, but I didn't find anything.
So I think I could use some kind of Reformat component, could I ?
If this is the solution, which metadata have I to put, on which edge ?
Is it something like that :
8<-----------------
<Graph>
<Global>
<Metadata id="InMetadata">
<Record name="Employees" type="delimited">
<Field name="field1" type="string" delimiter=";"/>
<Field name="field2" type="string" delimiter=";"/>
<Field name="field3" type="string" delimiter=";"/>
<Field name="field4" type="string" delimiter=";"/>
</Record>
</Metadata>
<Metadata id="OutMetadata">
<Record name="Employees" type="delimited">
<Field name="field1" type="string" delimiter=";"/>
<Field name="field2" type="string" delimiter=";"/>
<Field name="field4" type="string" delimiter=";"/>
</Record>
</Metadata>
</Global>
<Phase number="0">
<Node id="INPUT1" type="DELIMITED_DATA_READER_NIO" fileURL="InputFile.csv" DataPolicy="Strict" />
<Node id="SELECT_FIELD" type="???????" />
<Node id="OUTPUT1" type="DELIMITED_DATA_WRITER_NIO" fileURL="OutputFile.csv" DataPolicy="Strict" />
<Edge id="INEDGE1" fromNode="INPUT1:0" toNode="SELECT_FIELD:0" metadata="InMetadata" />
<Edge id="INNEREDGE1" fromNode="BROADCAST:0" toNode="OUTPUT1:0" metadata="OutMetadata" />
</Phase>
</Graph>
8<-----------------
Any help is appreciated.
Thanks in advance (and excuse me for my ugly english)
Francois
-
I tried something like that. In fact it was my first idea of what is a metadata and how I can use it, but the process stop after the first line... I will have another look at my xml to see where is my error.
Many thanks for your help,
François -
Hello!
In one minute i prepared in Clover.GUI easy schema for your purpose.
<?xml version="1.0" encoding="UTF-8"?>
<Graph name="graph">
<Global>
<Metadata id="Metadata2">
<Record name="inputMetadata" type="delimited">
<Field delimiter=";" locale="cs.CZ" name="Field1" nullable="true" type="string"/>
<Field delimiter=";" locale="cs.CZ" name="Field2" nullable="true" type="string"/>
<Field delimiter=";" locale="cs.CZ" name="Field3" nullable="true" type="string"/>
<Field delimiter="\r\n" locale="cs.CZ" name="Field4" nullable="true" type="string"/>
</Record>
</Metadata>
<Metadata id="Metadata3">
<Record name="outputMetadata" type="delimited">
<Field delimiter=";" locale="cs.CZ" name="Field1" nullable="true" type="string"/>
<Field delimiter=";" locale="cs.CZ" name="Field2" nullable="true" type="string"/>
<Field delimiter="\r\n" locale="cs.CZ" name="Field4" nullable="true" type="string"/>
</Record>
</Metadata>
</Global>
<Phase number="0">
<Node enabled="enabled" guiHeight="0" guiName="Delimited Data Reader (New I/O)" guiWidth="0" guiX="216" guiY="286" id="DELIMITED_DATA_READER_NIO0" type="DELIMITED_DATA_READER_NIO"/>
<Node append="false" enabled="enabled" guiHeight="0" guiName="Delimited Data Writer (New I/O)" guiWidth="0" guiX="611" guiY="279" id="DELIMITED_DATA_WRITER_NIO0" type="DELIMITED_DATA_WRITER_NIO"/>
<Node enabled="enabled" guiHeight="0" guiName="Reformat" guiWidth="0" guiX="417" guiY="287" id="REFORMAT0" type="REFORMAT">
<attr name="transform">${out.0.Field1} = ${in.0.Field1};
${out.0.Field2} = ${in.0.Field2};
${out.0.Field4} = ${in.0.Field4};
</attr>
</Node>
<Edge fromNode="DELIMITED_DATA_READER_NIO0:0" guiBendpoints="" id="Edge0" inPort="0 (Reformat)" metadata="Metadata2" outPort="0 (Delimited Data Reader (New I/O))" toNode="REFORMAT0:0"/>
<Edge fromNode="REFORMAT0:0" guiBendpoints="" id="Edge1" inPort="0 (Delimited Data Writer (New I/O))" metadata="Metadata3" outPort="0 (Reformat)" toNode="DELIMITED_DATA_WRITER_NIO0:0"/>
</Phase>
</Graph>
If you have any questions, i'm ready to answer you. GL, Martin. -
First mistake i see in the last field of your metadata. Delimiter is probably \r\n or \n.
OtaSanek
Please sign in to leave a comment.
Comments 3