Search collections

If you want to filter the records exported by an export mapping file, you can add a <SearchCollection> element. <SearchCollection> is a child of the root <DataExport> element, and has a <Searches> element as a child. <Searches> has one or more <Search> elements as children, each of which defines a selection parameter.

The sample below shows the beginning of a mapping file that exports the BuildingApplication object, using a search collection to export only applications with a status of “Open.” The SourceProperty attribute specifies the property you want to use, the Operator specifies the comparison operator, and the Value attribute specifies the value for the comparison.

<DataExport Name="CDRBuilding" 
 RootElement="BuildingApplication" 
 TargetBusinessObject="Hansen.CDR.Building.BuildingApplication">
   <SearchCollection ParentElement="BuildingApplications">
      <Searches>
         <Search SourceProperty="BuildingApplicationStatus.Code" 
          Operator="Equal" Value="Open" />
      </Searches>
   </SearchCollection>
   ...

The ParentElement attribute of the <SearchCollection> element defines a new root element for the data export file. The root element defined in the <DataExport> element then becomes a child of the parent element. In the example above, the root element of the export file will be called <BuildingApplications>. Each building application that matches the search criteria will be mapped to a <BuildingApplication> element, which will be a child of <BuildingApplications>.