skip to main content
Corticon Studio: Rule Modeling Guide : Writing Rules to access external data : Precondition and Filters as query filters : Using multiple filters in Filter Queries
 

Try Corticon Now
Using multiple filters in Filter Queries
One or more filters can be set as a database filter. When multiple filters are set as database filters, Corticon logically combines them with the AND operator to form one database query.
Note: If the database filters have different entity/alias references they will not be logically combined into one query. Each filter will execute in processing order. To determine which expression gets processed first, generate an execution sequence diagram by choosing Rulesheet > Rulesheet > Execution Sequence Diagram from Studio’s menubar.
Consider the filters:
*Customer.age > 18
*Customer.status = ‘GOLD’
the result is one database query:
Select * from Customer where age > 18 and status = “GOLD”
However, when the two filters are:
*Customer.age > 18
*Order.total > 1000
the result is two database queries (because Customer and Order are not logically related):
Select * from Customer where age > 18
Select * form Order where total > 1000
When the database filter contains more than one database entity/alias -- a compound filter -- it still acts as a single query. For example:
*Order.bid >= Item.price
which results in the query:
Select * from Order o,Item i where o.bid > i.price
When there are multiple filters related to one or more of the entities in a compound filter, they are combined with the AND operator For example, consider the filters:
*Order.bid >= Item.price
*Order.status = ‘VALID’
*Item.qty > 0
which results in the query:
Select * from Order o,Item I where o.bid > i.price and o.status = “VALID” and i.qty > 0