Data Centric Functions
Filtering Data
By default, the Get<DataType>Xml function retrieves all the data items of a specific data type. In practice, you might only need specific data items that match certain conditions. And this is where filtering comes in handy.
You specify your filters in the Filter parameter of the Get<DataType>Xml function:
- Filter: (Expression<Func<[DataType],Boolean>>): An expression function that takes the datatype as its input parameter, iterates the data items and returns ‘true’ if a data item matches s specific condition and ‘false’, if it doesn’t.
To filter data, you should use one of the filter functions available for the data type in question. You can use two types of filters:
- DataReferenceFilter, which selects a single data item
- FieldPredicatesFilter, which selects multiple data items that meet the criteria you can set with predicates on each of the data type’s field.
And the CompoundFilter function allows you to combine two filters defining relations between them as “And” or “Or”.
To filter data:
- Select the Filter parameter.
- Click Function in the Parameter type group box.
- In the Value for Parameter ‘Filter’ window, expand All functions, then namespaces the data type belongs to (e.g. “Contoso.Customers”).
Figure 5: Selecting one of the filter functions
- Select one of the filter functions and click OK. The function will appear under the Filter parameter of the Get<DataType>Xml function in the Function Calls tree.
- Set its parameters.
Figure 6: Setting a filter function’s parameters
- Save the function.