Creating Filter Clauses for the Orders and Profiles Adapters

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

The Orders and Profiles receive adapters provide the transport properties Filter Clause and Filter for profiles, respectively. These properties provide a mechanism for restricting the number of objects included in the export messages that they generate and submit to BizTalk Server for processing. In the case of the Orders receive adapter, this filtering mechanism is relevant only when the Orders receive adapter is performing incremental exports, and serves to further restrict the number of objects included in the generated export message or messages. In other words, when performing full exports, the value of the Filter Clause property is ignored.

Likewise, in the case of the Profiles receive adapter, this filtering mechanism is relevant only when the Profiles receive adapter is performing incremental exports. In addition, the transport property Profiles also serves as a filter for incremental exports. This property contains a comma-separated list of the profile types to be included in the generated export message. If you specify values for both of the Profiles transport properties, Filter for profiles and Profiles, all profile properties in the filter clause specified by the former property must apply to all the profile types specified by the latter property.

Note

Although these filter clause properties do provide a way to further restrict the number of objects included in an incremental export message generated by the relevant Commerce Server receive adapter and then submitted to BizTalk Server, you may find it more effective to perform the same filtering using the power of BizTalk Server. If you use such an approach, your incremental export messages from Commerce Server to BizTalk Server will include all objects created or updated since the last time the relevant adapter was run, and you perform your additional filtering within, for example, a BizTalk orchestration.

Note

If you specify a DateTime value in an Orders or Profiles filter clause, you must use a culture-invariant format. For more information, see the System.Globalization.CultureInfo.InvariantCulture property and the System.Globalization.DateTimeFormatInfo.InvariantInfo property in the .NET Framework class library.

This topic provides an example of an orders filter clause and an example of a profiles filter clause.

Orders Filter Clause Example

The following example restricts an incremental export operation using the Orders receive adapter to include only purchase orders for which the total is $1,000 or more.

Aa545797.alert_caution(en-US,CS.70).gifImportant Note:

The text edit field for the Orders receive adapter transport property Filter Clause does not allow multiple lines to be edited. Therefore, you should edit filter clauses in another application, such as Notepad, and remove all line feed characters before pasting the filter clause into the Filter Clause text edit field.

<CLAUSE OPER="greater-than" xmlns="https://schemas.microsoft.com/CommerceServer/2004/02/Expressions">
  <PROPERTY ID="total"
            MULTIVAL="false"
            TYPE="Number" />
  <IMMED-VAL TYPE="Number">
    <VALUE>999.99</VALUE>
  </IMMED-VAL>
</CLAUSE>

Profiles Filter Clause Example

The following example restricts an incremental export operation using the Profiles receive adapter to include only objects with their organizations (org_id) equal to either "Human Resources" or "Finance". Because objects other than user objects may not have the org_id property, it would also be important to set the value of the transport property Profiles to be "UserObjects", thereby avoiding "property not found" errors.

Aa545797.alert_caution(en-US,CS.70).gifImportant Note:

The text edit field for the Profiles receive adapter transport property Filter for profiles does not allow multiple lines to be edited. Therefore, you should edit filter clauses in another application, such as Notepad, and remove all line feed characters before pasting the filter clause into the Filter for profiles text edit field.

<TERM TYPE="or" xmlns="https://schemas.microsoft.com/CommerceServer/2004/02/Expressions">
  <CLAUSE OPER="equal">
    <PROPERTY ID="org_id"
              MULTIVAL="false"
              TYPE="String" />
    <IMMED-VAL TYPE="String">
      <VALUE>Human Resources</VALUE>
    </IMMED-VAL>
  </CLAUSE>
  <CLAUSE OPER="equal">
    <PROPERTY ID="org_id"
              MULTIVAL="false"
              TYPE="String" />
    <IMMED-VAL TYPE="String">
      <VALUE>Finance</VALUE>
    </IMMED-VAL>
  </CLAUSE>
</TERM>

See Also

Other Resources

How to Configure the Orders Transport Properties for a Receive Endpoint

How to Configure the Profiles Transport Properties for a Receive Endpoint

BizTalk Adapter Concepts