as groups from gives the group names corresponding to a set of attribute (or group) names. As an attribute can be in more than one group, the as groups from syntax requires you to specify the set of groups you are interested in. For example, consider the expression
{allergens} in range [50, 5000]
This might have as its value for a particular case the attributes and values
Dog (65.11), Birch (63.60), Cat (52.1) and Eucalypt (52.1)
We now apply the as groups from function as follows:
{allergens} in range [50, 5000] as groups from {food, pollen, mite, mould, animal}
This expression will evaluate to
animal and pollen
since Birch and Eucalypt are in the pollen group and Dog and Cat are in the animal group. In the evaluation, ‘animal’ comes before ‘pollen’ since the highest value (65.11 for Dog) was an animal allergen.
Note: in this example that there were two animal allergens and two pollen allergens. If there had only been one pollen allergen, the as groups from function would give the allergen name rather than the group name. For example, if
{allergens} in range [50, 5000]
had evaluated as
Dog (65.11), Cat (52.1) and Eucalypt (52.1)
then the expression
{allergens} in range [50, 5000] as groups from {food, pollen, mite, mould, animal}
would evaluate to
animal and Eucalypt
This behaviour (using the group name) can be modified using a with {GroupLength=n} clause.
Note: if the as groups from expression gives an attribute name, the value of that attribute is not shown.
To take another example, if
{allergens} in range [50, 5000]
had evaluated as
Birch (63.60), Cat (52.1) and Eucalypt (52.1)
then the expression
{allergens} in range [50, 5000] as groups from {food, pollen, mite, mould, animal}
would evaluate to
pollen and Cat
with pollen listed first since the highest pollen value, Birch (63.60) is higher than the Cat value (52.1).
Suppose the Birch and Eucalypt pollens were also in a tree pollen group (e.g. TreePollen), then the expression
{allergens} in range [50, 5000] as groups from {food, TreePollen, mite, mould, animal}
would now evaluate as
TreePollen and Cat
We can combine the as groups from function with other expressions, including the number of function. For example, suppose that VeryHigh is a calculated value attribute with expression
{allergens} in range [50, 5000]
Then we could define a further calculated value attribute VeryHighGroups using the expression
{VeryHigh} as groups from {food, pollen, mite, mould, animal}
We might then add the comment
with the condition
number of VeryHighGroups > 1
See also: not in