Updation of Dataload utility table

When a dataload utility table runs a few times, the data is overridden.

Problem

When the dataload utility rans a couple of times, some tables are overridden, and the resulting OPTCOUNTER is updated with 1. It shows an update on an existing row instead of inserting a new row.

Solution

Modify the wc-loader-xxx.xml file configuration to move the definition of the PRIMARY_KEY/UNIQUE_ID column to the end of the table.
  • Locate the following lines of code:
    <_config:Table name="CALRULE" excludeUnListedColumns="true" deleteKey="Delete" deleteValue="1">
    <_config:Column name="CALRULE_ID" value="CALRULE_ID" valueFrom="IDResolve">
    <_config:IDResolve tableName="CALRULE" generateNewKey="true" />
    </_config:Column>
    <_config:Column name="CALCODE_ID" value="CALCODE_ID" valueFrom="IDResolve" />
    <_config:Column name="TAXCGRY_ID" value="TAXCGRY_ID" valueFrom="IDResolve" >
    <_config:IDResolve tableName="TAXCGRY" generateNewKey="false">
    <_config:UniqueIndexColumn name="NAME" value="TaxCategoryName" />
    <_config:UniqueIndexColumn name="STOREENT_ID" value="Storeentid" />
    </_config:IDResolve>    
    </_config:Column>    
    <_config:Column name="SEQUENCE" value="Sequence" />
    <_config:Column name="COMBINATION" value="2" valueFrom="Fixed" />        
    <_config:Column name="CALMETHOD_ID" value="CalRuleMethodId" />
    <_config:Column name="CALMETHOD_ID_QFY" value="CalRuleMethodIdQfy" />
    <_config:Column name="FLAGS" value="1" valueFrom="Fixed" />
    <_config:Column name="IDENTIFIER" value="Identifier" />                
    </_config:Table>
  • Update the code with the following lines of code:
    <_config:Table name="CALRULE" excludeUnListedColumns="true" deleteKey="Delete" deleteValue="1">
    <_config:Column name="CALCODE_ID" value="CALCODE_ID" valueFrom="IDResolve" />
    <_config:Column name="TAXCGRY_ID" value="TAXCGRY_ID" valueFrom="IDResolve" >
    <_config:IDResolve tableName="TAXCGRY" generateNewKey="false">
    <_config:UniqueIndexColumn name="NAME" value="TaxCategoryName" />
    <_config:UniqueIndexColumn name="STOREENT_ID" value="Storeentid" />
    </_config:IDResolve>
    </_config:Column>
    <_config:Column name="SEQUENCE" value="Sequence" />
    <_config:Column name="COMBINATION" value="2" valueFrom="Fixed" />
    <_config:Column name="CALMETHOD_ID" value="CalRuleMethodId" />
    <_config:Column name="CALMETHOD_ID_QFY" value="CalRuleMethodIdQfy" />
    <_config:Column name="FLAGS" value="1" valueFrom="Fixed" />
    <_config:Column name="IDENTIFIER" value="Identifier" />
    <_config:Column name="CALRULE_ID" value="CALRULE_ID" valueFrom="IDResolve">
    <_config:IDResolve tableName="CALRULE" generateNewKey="true" />
    </_config:Column>
    </_config:Table>
  • In the above example, the definition of the column CALRULE_ID is moved to the end of the table CALRULE. Subsequently, when the data load runs, instead of updating the existing row, it inserts the new entry into the table.