Script for importing items with xProperties from Excel using Batch Loader

I just went through this process as part of learning Aras. Importing items from Excel using the Batch Loader is pretty straightforward if you only have simple properties that all belong directly to the Item Type. See documentation for the Batch Loader. Note that you should save the Excel file as a tab-delimited .txt file.

It gets more difficult, however, when you need to import properties over relationships. In this case Costs over the Part Goal relationship and xProperties over Part_xClass.

I found no documentation to help me with this, so the script below is the result of a lot of trial and error. Comments and improvements welcome" It is my first import script! Copy the text below into Notepad++ for better readability.

A big difficulty was working out how to explicitly identify the xClass. I used the xClass Property "name". This used just the simple name of the "Leaf" xClass in the xClass tree.

Hope it saves someone a bit of time :)

(Extract to show the highlights...)

<Item type='Part' action='add'>
    <!--Use Action='edit' when updating items-->
    <!--@10, etc. denotes the column in the data file and is independent of the header row contents-->
    <item_number>@2</item_number>
    <name>@4</name>
    <classification>@5</classification>
    <Relationships>
        <!--Part Goal is the relationship item that links to item type Goal-->
        <Item type="Part Goal" action="add">
          <goal>@7</goal> <!--e.g. Cost-->
          <actual_value>@8</actual_value> <!--Further fields available, see Loader docs-->
         </Item>
        <!--Part_xClass is the relationship item from part to xClass-->
        <!--Note that "name" (lower case) is the easiest of several field options for identifying xClass-->
        <!--Format is, e.g. "Fuel Tanks" (name of leaf, spaces OK)-->
        <Item type="Part_xClass" action="add">
            <related_id>
                <Item type="xClass" action="get" select="id">
                    <name>@10</name>
                </Item>
            </related_id>
        </Item>
    </Relationships>
    <!--The properties below can only be loaded once the xClass relationship has been established as above-->
    <xp-mass_full set="value">@14</xp-mass_full>
</Item>

Parents Reply Children
No Data