Precondition and filters as query filters
- Last Updated: March 24, 2022
- 2 minute read
- Corticon
- Version 6.3
- Documentation
When the Enterprise Data Connector is in use, scope rows in a Rulesheet can act
as queries to an external database. When an alias definition is designated as Extend to Database, the scope of the alias is assumed to include all
database records in the entity’s corresponding table. But you often want or need to qualify
those queries to further constrain the data returned to the Server or Studio. You can think
of conditional clauses written in the Preconditions/Filters section of the Rulesheet
as placing constraints on these queries. If you are familiar with structured query
languages (SQL), then you may recognize these constraints as WHERE clauses” in a SQL query.
If you are not familiar with SQL, review the Filters and Preconditions topics to learn more about how a Precondition/Filter expression serves to reduce or filter the data in working memory so that only the data that satisfies the expression survives to be evaluated and processed by other rules on the same Rulesheet. EDC simply extends working memory to an external database; the function of the Precondition/Filter expression remains the same.
For performance reasons, it is often desirable to perform a complete query --
including any WHERE clauses -- inside the database before
returning the results set (the data) to Studio or Server. An unconstrained or unfiltered
results set from an external database may be very large, and takes time to transfer from
the database to Studio or Server. After the results set enters Studio’s or Server’s
working memory, then Preconditions/Filters expressions serve to reduce (or filter) the
results set further before rules are applied. But if we believe the unfiltered results set
will take too much time to transfer, then you may decide to execute the
Preconditions/Filters expressions inside the database query, thereby reducing the results
set prior to transmission to Studio or Server. This may make the entire database access
process faster.