Here is my scenario: I have a set of data I will call an item that I am reading from a text file. The item will be inserted into a database. The item contains version information in the form of a version name. I need to get the version key from my version table before I can insert the item. I use a DBJoin to get the version key. However, if the version key does not exist yet, I need to create the version key. I use the skipped records output port to move to the version insert. The problem I am struggling with is how to continue after the insert. Can I do a lookup after the insert? Basically I want either the result of the DBJoin or the insert passed to the insert for the item.
Hello,
if I understand well you need to put keys to the key’s table and then, once again, use DBJoin. It is not problem if you do it in different phases:
<?xml version="1.0" encoding="UTF-8"?>
<Graph id="1197027195231" name="graphDBJoin">
<Global>
<Metadata fileURL="${META_DIR}/delimited/employee.fmt" id="Metadata1"/>
<Metadata id="Metadata0">
<Record name="customer" recordDelimiter="\n" recordSize="212" type="fixed">
<Field name="customer_id" nullable="true" shift="0" size="4" type="integer"/>
</Record>
</Metadata>
<Metadata id="Metadata2">
<Record fieldDelimiter=";" name="joined" recordDelimiter="\n" recordSize="-1" type="delimited">
<Field locale="en.US" name="customer_id" nullable="true" shift="0" type="integer"/>
</Record>
</Metadata>
<Connection dbConfig="${CONN_DIR}/postgre.cfg" id="Connection0" type="JDBC"/>
<Property fileURL="workspace.prm" id="GraphParameter0"/>
</Global>
<Phase number="0">
<Node fileURL="${DATAIN_DIR}/fixlen/customers0.dat" id="DATA_READER0" type="DATA_READER"/>
<Node dbConnection="Connection0" id="DBJOIN0" joinKey="lname" sqlQuery="select * from employee where last_name=?" transformClass="TransformForDBjoin" type="DBJOIN"/>
<Node id="DB_OUTPUT_TABLE0" type="DB_OUTPUT_TABLE"/>
<Node guiName="Insert keys" id="DB_OUTPUT_TABLE1" type="DB_OUTPUT_TABLE"/>
<Node id="SIMPLE_COPY0" type="SIMPLE_COPY"/>
<Edge fromNode="DATA_READER0:0" id="Edge0" inPort="Port 0 (in)" metadata="Metadata0" outPort="Port 0 (output)" toNode="DBJOIN0:0"/>
<Edge fromNode="DBJOIN0:0" id="Edge2" inPort="Port 0 (in)" metadata="Metadata0" outPort="Port 0 (joined records)" toNode="DB_OUTPUT_TABLE0:0"/>
<Edge fromNode="DBJOIN0:1" id="Edge3" inPort="Port 0 (in)" metadata="Metadata0" outPort="Port 1 (skipped records)" toNode="SIMPLE_COPY0:0"/>
<Edge fromNode="SIMPLE_COPY0:0" id="Edge4" inPort="Port 0 (in)" metadata="Metadata0" outPort="Port 0 (out)" toNode="DB_OUTPUT_TABLE1:0"/>
<Edge fromNode="SIMPLE_COPY0:1" id="Edge5" inPort="Port 0 (in)" metadata="Metadata0" outPort="Port 1 (out)" toNode="DBJOIN1:0"/>
</Phase>
<Phase number="1">
<Node id="DBJOIN1" type="DBJOIN"/>
<Node id="DB_OUTPUT_TABLE2" type="DB_OUTPUT_TABLE"/>
<Edge fromNode="DBJOIN1:0" id="Edge1" inPort="Port 0 (in)" metadata="Metadata0" outPort="Port 0 (joined records)" toNode="DB_OUTPUT_TABLE2:0"/>
</Phase>
</Graph>