Importing Parent-child Data When the Parent Key is a Generated Value
Use xml.import with the multi-table-import parameter set to import p parent-child data when the parent key is a generated value. In the XML, use a RELATE element to point to the relationship between tables and the column that has to be automatically filled.
A standard manner to reference an element in XML is to use id-href pairs. One element declares an attribute called id and another element that needs to reference that initial element specifies an attribute called href with the value: #<value of the id attribute>. The problem in this case is that we cannot use id as an attribute since it could be the name of a column in the parent table. For this reason we will use <table name>. id.
The structure of the XML is as follows:
<?usoft-xml version="1.0" action="multi-tables-import" use-io-formats="no" verify-original-values="no" return-corrected-records ="yes"?>
<Departments documentName ="Departments">
<DEPARTMENT NAME= "CON" DEPARTMENT.id="CON"/>
<DEPARTMENT NAME= "INT" DEPARTMENT.id="INT"/>
<Employees documentName ="Employees">
<EMPLOYEE ID="1" NAME = "CONSTANTINC">
<RELATE ROLE="has" href="#CON"/>
<EMPLOYEE ID="1" NAME = "FRANS">
<RELATE ROLE="has" href="#INT"/>
The value of the DEPARTMENT.id can be any value chosen by the user; USoft uses this value only to match the reference from the child record with the parent record.