Metadata and defaults

An <Input> element can get a value from a metadata item or a default. The <Metadata> element is a child of the <Information> element, with one or more <Item> elements as children. Each <Item> defines a variable using Name and Value attributes. To use a metadata item in an <Input>, set the DefaultId attribute to the name of the item, as shown in this example:

<DataImport Name="DataImportVehicle">
   <Information>
      <Metadata>
         <Item Name="VehType" Value="CAR" />
      </Metadata>
   </Information>
   <Steps RootQuery="/VEHICLE">
      <Step Id="1" 
       TargetBusinessObject="Hansen.AssetManagement.Fleet.Vehicle" 
       Action="Create">
         <Inputs>
            <Input DefaultId="VehType" Target="UnitType" />
         </Inputs>
         <Mappings>
            <Map Source="@ID" Target="ID"/>
         </Mappings>
      </Step>
   </Steps>
</DataImport>

The <Defaults> element is similar. <Defaults> is a child of the root <DataImport> element, with one or more <Default> element as children. The only difference between a <Default> and a metadata <Item> is that a <Default> has an Id attribute where an <Item> has a Name attribute.

Both <Item> and <Default> have an optional Type attribute, which specifies the data type of the variable. The default data type is String. If you enter a different type, the import processor will attempt to convert the variable to that type. All .NET types are supported, but the import processor will return an error if there is a type mismatch. For example, attempting to convert the value abc123 to an integer (System.Int32) would result in an error.

Besides using them in inputs, you can also use a metadata item or a default for the Target attribute of a <Map> element.