Skip to Content
0
Former Member
Apr 21, 2015 at 09:17 AM

IMPEX: Document ID for required column/field not working

477 Views

Hi,

I'm having issues while importing a custom type, Distribution Center which has the following fields (all required):

 <itemtype code="DistributionCenter" extends="GenericItem" jaloclass="com.bose.hybris.common.jalo.DistributionCenter">
     <deployment table="DistributionCenter" typecode="11202"/>
     <attributes>
         <attribute qualifier="code" type="java.lang.String">
             <persistence type="property"/>
             <modifiers optional="false"/>
         </attribute>
         <attribute qualifier="name" type="java.lang.String">
             <persistence type="property"/>
             <modifiers optional="false"/>
         </attribute>
         <attribute qualifier="address" type="Address">
             <persistence type="property"/>
             <modifiers optional="false"/>
         </attribute>
     </attributes>
 </itemtype>

To import our essential data for these distribution centers, I use Document IDs to assign the address to the DC. Just setting the owner of the address to the DC doesn't seem to work, the DC address reference remains empty in the HMC.

This is the essential data IMPEX:

 INSERT_UPDATE DistributionCenter; code[unique = true]; name; address(&dcID)
 ; "WSTG" ; "Bilzen, SC" ; dc1
 ; "SSTG" ; "Georgetown, AZ" ; dc2
 
 INSERT_UPDATE Address; &dcID; owner(DistributionCenter.code)[unique = true]; postalcode; town; region(isocode); country(isocode)
 ; dc1 ; "WSTG" ; "29016" ; "Bilzen" ; "US-SC" ; "US"
 ; dc2 ; "SSTG" ; "85353" ; "Georgetown"   ; "US-AZ" ; "US"

The error the IMPEX engine throws is the following:

 INSERT_UPDATE DistributionCenter;code[unique = true];name;address(&dcID)
 ,,,cannot create due to unresolved mandatory/initial columns, column 3: cannot resolve value 'dc1' for attribute 'address';WSTG;Bilzen, SC;dc1
 ,,,cannot create due to unresolved mandatory/initial columns, column 3: cannot resolve value 'dc2' for attribute 'address';SSTG;Georgetown, AZ;dc2
 

When the address field is optional for the DC, it works. So it seems the IMPEX engine can't handle Document IDs when the field is required? Is there a way around this, using plain IMPEX? (I'd rather not make address optional...)

Thanks for your input!

Vincent

SOLUTION:

A reference in both directions is needed. So DC -> Address and Address -> DC, like this:

 insert Address;&Item;country(isocode);owner(&Item)[allownull=true];postalcode;region(isocode);town
 ;Item0;US;Item1;29016;US-SC;Bilzen
 ;Item2;US;Item3;85353;US-AZ;Georgetown
 
 insert DistributionCenter;&Item;address(&Item)[allownull=true];code[allownull=true];name[allownull=true];owner(&Item)[allownull=true]
 ;Item1;Item0;WSTG;Bilzen, SC
 ;Item3;Item2;SSTG;Georgetown, AZ