union combines two sets a single set. The simplest syntax is

X union Y

where X and Y are sub-expressions giving sets. For example, in a lab where the tests requested for a patient are put as comma-separated values in the two distinct attributes TestsRequested and TestsOrdered, we could get the complete set of tests ordered for a patient using this expression:

TestsRequested as set union TestsOrdered as set

union also combines two sets of attributes into a single set. The syntax is

{ names } in range [lower, upper] union { names } in range [lower, upper]

where:

names are comma separated lists of attribute names or group attribute names

lower and upper are constants or numbers defining the ranges.

For example, suppose you want a comment to contain the names from two sets of allergens

{milk, cod, peanut} in range [15.0,50)

and

{wheat, soya} in range [50,1000]

You can define a calculated value attribute HighAllergens as

{milk, cod, peanut} in range [15.0,50) union {wheat, soya} in range [50,1000]

and the case would then appear as:

age            6
sex            F
milk           0.0
peanut         43.5
cod            12.1
soya           64.6
wheat          25.3
HighAllergens	soya (64.6) and peanut (43.5)

A comment could now be created that used the expression HighAllergens to list those allergens.

Note the following:

  • As with all lists of attributes, the attribute names whose values are highest are listed first,
  • If more than one attribute value is within the range, the attribute names and values are separated by commas, with the word “and” separating the last two.

See also: for