Steps

The data import process is broken down into steps so that you can define complex imports involving more than one XML element or business object.

This example shows an employee record as it might be represented in a data import file.

<EMPLOYEE>
   <ID>Demo001</ID>
   <FirstName>Demo</FirstName>
   <LastName>User</LastName>
   <Address>123 Main St.</Address>
   <City>San Francisco</City>
   <State>CA</State>
   <Zip>94110</Zip>
   <HireDate>9/21/2005</HireDate>
</EMPLOYEE>

In Infor Public Sector, each employee is represented by three different records. As a person with whom the agency interacts, the employee is represented by a contact identity record, which stores personal information such as the employee’s name and date of birth. Contact information, such as the employee’s address and telephone number, is stored in a contact record, and linked to the contact identity record through the identity key. Finally, an employee record, storing information such as the employee’s supervisor and hourly rate, is linked to the contact record through the contact key.

So to import an employee, the mapping file must create three different records in Infor Public Sector, and link them together properly. Therefore the mapping file has three steps.

The RootQuery attribute of the <Steps> element uses an XPath query to identify the <EMPLOYEE> element as the root of the import.

<Steps RootQuery="/EMPLOYEE">
</Steps>

The first step in the mapping file maps the employee data to the ContactIdentity object, as shown below. Note that the <Step> element has a child <Outputs> element, which has one <Output> element as a child. Outputs are used to maintain variables throughout the mapping. In this case, after the contact identity record is created, the identity key will be mapped to the output ID IDENTITY_KEY.

<Steps RootQuery="/EMPLOYEE">
   <Step Id="Identity" 
    TargetBusinessObject="Hansen.Resources.ContactIdentity" 
    Action="Create">
      <Outputs>
         <Output Id="IDENTITY_KEY" Source="IdentityKey"/>
      </Outputs>
      <Mappings>
         <Map Source="FirstName" Target="FirstName"/>
         <Map Source="LastName" Target="LastName"/>
      </Mappings>
   </Step>
</Steps>

Note also that the step’s Id attribute can be any alphanumeric value. Step IDs can be used to number steps, but here a descriptive ID is used instead.

The next step adds the contact record. This time the step includes an <Inputs> element, with one <Input> as a child. The input gets the value of the IDENTITY_KEY output from the previous step and maps it to the Identity property of the Contact object, thus linking the contact record to the contact identity record. Step 2 also has an output of its own, mapping the contact key to the ID CONTACT_KEY.

<Steps RootQuery="/EMPLOYEE">
   <Step Id="Identity" 
    TargetBusinessObject="Hansen.Resources.ContactIdentity" 
    Action="Create">
      <Outputs>
         <Output Id="IDENTITY_KEY" Source="IdentityKey"/>
      </Outputs>
      <Mappings>
         <Map Source="FirstName" Target="FirstName"/>
         <Map Source="LastName" Target="LastName"/>
      </Mappings>
   </Step>
   <Step Id="Contact" 
    TargetBusinessObject="Hansen.Resources.Contact" 
    Action="Create">
      <Inputs>
         <Input VariableId="IDENTITY_KEY" Target="Identity" />
      </Inputs>
      <Outputs>
         <Output Id="CONTACT_KEY" Source="ContactKey" />
      </Outputs>
      <Mappings>
         <Map Source="Address" Target="AddressLine1"/>
         <Map Source="City" Target="City"/>
         <Map Source="Zip" Target="PostalCode"/>
      </Mappings>
   </Step>
</Steps>

The final step adds the employee record, using the CONTACT_KEY output from the second step to link the employee to the contact record.

<Steps RootQuery="/EMPLOYEE">
   <Step Id="Identity" 
    TargetBusinessObject="Hansen.Resources.ContactIdentity" 
    Action="Create">
      <Outputs>
         <Output Id="IDENTITY_KEY" Source="IdentityKey"/>
      </Outputs>
      <Mappings>
         <Map Source="FirstName" Target="FirstName"/>
         <Map Source="LastName" Target="LastName"/>
      </Mappings>
   </Step>
   <Step Id="Contact" 
    TargetBusinessObject="Hansen.Resources.Contact" 
    Action="Create">
      <Inputs>
         <Input VariableId="IDENTITY_KEY" Target="Identity" />
      </Inputs>
      <Outputs>
         <Output Id="CONTACT_KEY" Source="ContactKey" />
      </Outputs>
      <Mappings>
         <Map Source="Address" Target="AddressLine1"/>
         <Map Source="City" Target="City"/>
         <Map Source="Zip" Target="PostalCode"/>
      </Mappings>
   </Step>
   <Step Id="Employee" 
    TargetBusinessObject="Hansen.Resources.Employee" 
    Action="Create">
      <Inputs>
         <Input VariableId="CONTACT_KEY" Target="Contact"/>
      </Inputs>
      <Mappings>
         <Map Source="ID" Target="EmployeeID"/>
         <Map Source="HireDate" Target="HireDate"/>
      </Mappings>
   </Step>
</Steps>