Thanks for answer, I can but different trouble.
I test your examples graphLookupJoin.grf and by merge records from DELIMITED_DATA_READER and records from MySQL can not merge this records in LookupJoin.
By using your class, so running graph well with one coment (records from database transform - this way
10248|VINET|5|1|Petr Prikril
10248|VINET|5|2|Jakub Janda
10248|VINET|5|5|Petra Hulova
10249|TOMSP|6|1|Petr Prikril
10249|TOMSP|6|2|Jakub Janda
10249|TOMSP|6|5|Petra Hulova
10250|HANAR|4|1|Petr Prikril
10250|HANAR|4|2|Jakub Janda
10250|HANAR|4|5|Petra Hulova
10251|VICTE|3|1|Petr Prikril
I can so as transform record this way. How can I do it.
10248|VINET|5|1|Petr Prikril
10249|TOMSP|6|2|Jakub Janda
10250|HANAR|4|5|Petra Hulova
Thanks
So and this more big trouble. By using transformation editor without using your transformation code but no loading Fields from database to transformation editor. This ground have by result that I can not add fields metadata from database to final fields metadata and graph finish with result failed.
I can not add next port, Lookups (Lookups Table have defined and connect to database MySQL), Join key - EmployeeID.
Thanks for answer
This is your transformation code
import org.jetel.component.DataRecordTransform;
import org.jetel.data.DataRecord;
import org.jetel.data.RecordKey;
import org.jetel.data.lookup.LookupTable;
import org.jetel.exception.JetelException;
import org.jetel.graph.TransformationGraph;
public class reformatTest extends DataRecordTransform{
public boolean transform(DataRecord[] source, DataRecord[] target){
if (source[1]==null) return false; // skip this one
target[0].getField(0).setValue(source[0].getField(0).getValue());
target[0].getField(1).setValue(source[0].getField(1).getValue());
target[0].getField(2).setValue(source[0].getField(2).getValue().toString());
target[0].getField(3).setValue(source[1].getField(0).getValue().toString());
target[0].getField(4).setValue(source[1].getField(1).getValue());
return true;
}
}
I test your examples graphLookupJoin.grf and by merge records from DELIMITED_DATA_READER and records from MySQL can not merge this records in LookupJoin.
By using your class, so running graph well with one coment (records from database transform - this way
10248|VINET|5|1|Petr Prikril
10248|VINET|5|2|Jakub Janda
10248|VINET|5|5|Petra Hulova
10249|TOMSP|6|1|Petr Prikril
10249|TOMSP|6|2|Jakub Janda
10249|TOMSP|6|5|Petra Hulova
10250|HANAR|4|1|Petr Prikril
10250|HANAR|4|2|Jakub Janda
10250|HANAR|4|5|Petra Hulova
10251|VICTE|3|1|Petr Prikril
I can so as transform record this way. How can I do it.
10248|VINET|5|1|Petr Prikril
10249|TOMSP|6|2|Jakub Janda
10250|HANAR|4|5|Petra Hulova
Thanks
So and this more big trouble. By using transformation editor without using your transformation code but no loading Fields from database to transformation editor. This ground have by result that I can not add fields metadata from database to final fields metadata and graph finish with result failed.
I can not add next port, Lookups (Lookups Table have defined and connect to database MySQL), Join key - EmployeeID.
Thanks for answer
This is your transformation code
import org.jetel.component.DataRecordTransform;
import org.jetel.data.DataRecord;
import org.jetel.data.RecordKey;
import org.jetel.data.lookup.LookupTable;
import org.jetel.exception.JetelException;
import org.jetel.graph.TransformationGraph;
public class reformatTest extends DataRecordTransform{
public boolean transform(DataRecord[] source, DataRecord[] target){
if (source[1]==null) return false; // skip this one
target[0].getField(0).setValue(source[0].getField(0).getValue());
target[0].getField(1).setValue(source[0].getField(1).getValue());
target[0].getField(2).setValue(source[0].getField(2).getValue().toString());
target[0].getField(3).setValue(source[1].getField(0).getValue().toString());
target[0].getField(4).setValue(source[1].getField(1).getValue());
return true;
}
}
-
Hi, I'm not sure if I have understood your question well, but I thing that you should use another field for joining. In our example record from file:
10248|VINET|5|4.7.1996 0:00:00|1.8.1996 0:00:00|16.7.1996 0:00:00|3|32.38|Vins et alcools Chevalier|59 rue de l'Abbaye|Reims||51100|France
is joined with record from db:
5;Maya Gutierrez;Maya;Gutierrez;2;VP Country Manager;0;1;Thu May 10 00:00:00 CET 1951;Thu Jan 01 00:00:00 CET 1998;;35000.0;1;Bachelors Degree;M;F;Senior Management
with join key: on db - employee_id, on text file - EmployeeID (marked red).
About your second question: thats true, that you can't do such transformation only by drag and drop, because the second metadata are lacking. You have to write it manually in "Source" tab. Transformation should look like that:
${out.0.OrderID} = ${in.0.OrderID};
${out.0.CustomerID} = ${in.0.CustomerID};
${out.0.EmployeeID} = ${in.0.EmployeeID};
${out.0.EmployeeID2} = ${in.1.employee_id};
${out.0.LastName} = ${in.1.full_name};
where in.1 means records from db.
Please sign in to leave a comment.
Comments 1