Factory Link Rules
The link rule allows you to copy data from one data set to another. The link rule requires a key, which is a rule in one data set that matches a rule in the other data set.
The link rule connects records from the two data sets that share the same value for the selected key. The link rule applies a summarizing mathematical expression to the records in one data set and places the result in the corresponding records in the other data set.
Link rules are placed directly in the data-set block as shown in the following example.
data-set "Accounts" { cbase-input "/data/accounts.cbase"
calc-rule "Admission" `value("Patient Type") = "Inpatient" and not value("Newborn")`
link "Charges" {
key "Account ID"
link-rule "Newborn" `sum(value("Charge")) > 0` filter=`value("Newborn Bed Charge")`
}
}
This link rule specifies the following values:
- link—Creates a link named Charges between the Accounts data set (where the link is defined) and Charges data set (named in the link definition).
- key—The link uses the key Account ID.
- link rule—Specifies a Spectre expression calculation and a filter to define the rule.
See also:
Mentioned in: