Data Centric Functions
Using Field Predicates Filter
To select multiple data items that meet some criteria you, use the FieldPredicatesFilter function:
- Select the FieldPredicatesFilter function for the Filter parameter.
- Use the Composite.Utils.Predicates functions to filter on one or more fields.
When you add the FieldPredicatesFilter function, it lists a number of parameters, each of which is a filter parameter for one field of the data type.
For example, if you have such fields in your data type as Id, Name, Email, Company, the FieldPredicatesFilter function will have such parameters as Id filter, Name filter, Email filter, Company filter.
Figure 10: Setting one of the field filters
Setting criteria on multiple fields has them enforced.
To set a field filter parameter, you should use one of the predicate functions (Composite.Utils.Predicates). Each predicate function expects a function expression (expression tree) as its value and always returns a Boolean.
Each type of the field has its own set of predicates:
Boolean
- BooleanEquals
- NullableBooleanEquals
- BooleanNoValue
DateTime
- DateTimeEquals
- DateTimeGreaterThan
- DateTimeLessThan
- NullableDateTimeEquals
- NullableDateTimeGreaterThan
- NullableDateTimeLessThan
- NullableDateTimeNoValue
Decimal
- DecimalEquals
- DecimalGreaterThan
- DecimalLessThan
- NullableDecimalEquals
- NullableDecimalNoValue
Guid
- GuidEquals
- NullableGuidEquals
- NullableGuidNoValue
Integer
- IntegerEquals
- IntegerGreaterThan
- IntegerLessThan
- NullableIntegerEquals
- NullableIntegerNoValue
String
- StringContains
- StringEndsWith
- StringEquals
- StringInCommaSeparatedList
- StringInList
- StringNoValue
- StringStartsWith
Basically, each type has an “Equals” predicate, and if they are nullable, they also include a nullable version of the “Equals” predicate and a “NoValue” predicate.
Number-related types such as Decimal, Integer and DateTime have “GreaterThan” and “LessThan” predicates.
Strings and Guids also have the “InCommaSeparatedList” predicate.
Besides, the String type has “StartsWith” and “EndsWith” predicates.
For the data reference types, the Guid-related predicate functions are used.
The functions are self-explanatory but you can generate documentation for these predicates functions in the CMS Console.
To set a field filter’s value:
- Select the field filter parameter of the FieldPredicatesFilter, e.g. “Email filter”
- Click Function in the Parameter type box.
- In the Value for Parameter window, select the predicate function, e.g. Composite.Utils.Predicates.StringEndsWith.
Figure 11: Selecting a predicate function for the string field filter
- If the predicate function has parameters, set them, too. (For example, for the StringEndsWith, you should set the Value to Compare with parameter, e.g. “gmail.com”.)
Figure 12: Setting a parameter of a predicate function
(In the example used with the steps above, those customers will be only retrieved whose email address is that of Google Mail.)