The following two examples illustrate the potential use for the Derivation
Example 1: Specifying an authoritative source for a global field
Example 2: Mapping one set of values into another set
The following example uses the first value, if defined. If the first value is not defined, then it uses the second value.
<Derivation> <or> <ref>accounts[AD].fullname</ref> <ref>accounts[LDAP].fullname</ref> </or> </Derivation>
The following example of using the <Derivation> element shows a field definition that uses conditional logic to map one set of values into another set.
In this example, the resource account attribute accounts[Oracle].locCode is evaluated against the AUS case element first. If it is true, then the second value is the value returned and displayed in the location field. If no cases are matched, then the value of the default case is returned. When a matching abbreviation is found as the first expression within a case expression, the value of the second expression within the case expression is returned as the result of the switch expression.
<Field name=’location’ prompt=’Location’> <Display class=’Text’/> <Derivation> <switch> <ref>accounts[Oracle].locCode</ref> <case> <s>AUS</s> <s>Austin</s> </case> <case> <s>HOU</s> <s>Houston</s> </case> <case> <s>DAL</s> <s>Dallas</s> </case> <case default=’true’> <s>unknown</s> </case> </switch> </Derivation> </Field>