HK Express Membership Engagement PlatformDemo environment, sample data only

Aggregation options for the Japan Explorer mission

The mission rule needs one number: Japan cities flown in the campaign window. The same rule can get it in three ways. Pick a member to compare.

Option 1: Built-in functions in the BRE
Runs in the BRE on every event
count(member.flownSectors,
  #.country == "JP" and
  date(#.flown) >= date(campaign.start) and
  date(#.flown) <= date(campaign.end))
Japan sectors in window
…
No rule fired
Maintained byBU team, in an expression box
FreshnessUp to date at each event
Data sent per evaluation…
Evaluation time…
Open the rule
Option 2: Prepared at source (GCP)
Counted in GCP, sent in the daily sync
gcp.japanCitiesInWindow

// computed in GCP from all UO data,
// arrives with the daily sync
Japan cities in window
…
No rule fired
Maintained byUO data team for the count, BU team for the rule
FreshnessAs of the last daily sync
Data sent per evaluation…
Evaluation time…
Open the rule
Option 3: JavaScript function in the BRE
Runs in the BRE on every event
const cities = new Set(sectors
  .filter((s) => s.country === "JP"
    && s.flown >= start && s.flown <= end)
  .map((s) => s.city));
return { count: { japanCities: cities.size } };
Japan cities in window
…
No rule fired
Maintained byDeveloper for the code, BU team for the rule
FreshnessUp to date at each event
Data sent per evaluation…
Evaluation time…
Open the rule
What each option means to maintain
All three feed the same decision table. The difference is where the count lives and who looks after it.
1. Built-in functions2. Prepared at source3. JavaScript function
Counts different valuesNo. Count, sum, average, min and max onlyYes, any logic the data team writesYes, any logic in code
History needed at runtimeYes, sent with every eventNo, one numberYes, sent with every event
Reuse in reports and CDPNo, the count lives inside one ruleYes, the same figure feeds dashboards and segmentsNo, the count lives inside one rule
Change needsBU team, test and publishData team change in GCPDeveloper, code review and test