Skip to content

Cross-Object Comparisons

Rules can compare values across different objects by referencing multiple selectors.

Comparing Across Objects

Reference different selectors in each side of a condition:

A **Application** gets approved
if __age__ of **Applicant** is greater than 18
and __score__ of **CreditReport** is greater than 700.

Each selector must be a key in the JSON data:

{
"Applicant": { "age": 25 },
"CreditReport": { "score": 750 }
}

Interactive Example

Policy Rule
Test Data (JSON)

Multiple Data Sources

This pattern is powerful for rules that combine data from different systems:

Interactive Example

Policy Rule
Test Data (JSON)

Rules About the Primary Selector

The primary selector (after A/An) identifies what the rule is about. It doesn’t have to contain the properties being checked — it’s the subject of the outcome:

A **Loan** gets approved ← the Loan is what gets approved
if __income__ of **Applicant** is greater than 50000 ← but we check the Applicant
and __score__ of **Credit** is greater than 700. ← and the Credit report