Predicates allow you to create a match between elements (for example, a measure header item or an attribute header item) with an arbitrary level of complexity.
For example, a predicate that creates a simple match based on an equation may look like the following:
(headerItem) => headerItem.measureHeaderItem.localIdentifier === 'm1_localIdentifier'
Here is an example of a predicate that increments the
callCounter variable in the predicate's closure every time the predicate is called and returns
callCounter is an even number:
let callCounter = 0; const predicate = () => (callCounter++ % 2) === 0
A predicate is called with the following parameters:
Execution header with the type as defined here
Context with the type defined here
Context is an object that contains the
executionResponsekeys. These keys can be used for building complex matching conditions.
For more advanced predicates, see the predicate factories in HeaderPredicateFactory.