Oracle Waveset 8.1.1 Deployment Reference

Deriving Field Values

Some fields are used on the form solely to calculate other fields. These fields cannot be stored on any resource to which the user belongs. When the user record is edited, each of the resources is contacted and the field values for the attributes are populated. To populate the fields that are used for calculations, you can write derivation rules.

Example

A phone number field can be represented on the form as a single text box. However, a more advanced form might have three fields for the area code and phone number, which are used to calculate the phone number that is saved to the resource.

In the simple case of representing a phone number, you can have form fields that resemble the ones listed below.


<Field name=’P1’>
   <Display class=’Text’>
      <Property name=’title’ value=’Office Phone Number’/>
      <Property name=’size’ value=’3’/>
      <Property name=’maxLength’ value=’3’/>
   </Display>
</Field>
<Field name=’P2’>
   <Display class=’Text’>
      <Property name=’title’ value=’-’/>
      <Property name=’size’ value=’3’/>
      <Property name=’maxLength’ value=’3’/>
   </Display>
</Field>
<Field name=’P3’>
   <Display class=’Text’>
      <Property name=’title’ value=’-’/>
      <Property name=’size’ value=’4’/>
      <Property name=’maxLength’ value=’4’/>
   </Display>
</Field>
<Field name=’global.OfficePhone’>
   <Expansion>
      <concat>
         <ref>P1</ref><s>-</s>
         <ref>P2</ref><s>-</s>
         <ref>P3</ref>
      </concat>
   </Expansion>
</Field>

Example

The following example expands on the field definition for the field P1 defined above. It defines how a phone number attribute is read into the form, and consequently expands into the three field displays.


<Field name=’P1’>
   <Display class=’Text’>
      <Property name=’title’ value=’Office Number’/>
      <Property name=’size’ value=’3’/>
      <Property name=’maxlength’ value=’3’/>
   </Display>
</Field>

When a user enters data into Waveset, the form can ensure the data is entered properly. However, Waveset cannot ensure that data entered directly into the resource meets the same requirements. For example, over the years, administrators might have entered the phone number as 123-4567 (8 characters), 123-123-4567 (12 characters), or (123) 123-4567 (14 characters).

Example

The definition of the OfficePhone field remains the same as described previously, but each of the three fields (P1, P2, and P3) should be updated to use derivation rules, as this example illustrates for the P1 field.


<defvar name=’lenOfficePhone’>
   <length><ref>Office Phone</ref></length>
</defvar>
<Field name=’P1’>
   <Display class=’Text’>
      <Property name=’title’ value=’Office Phone Number’/>
      <Property name=’size’ value=’3’/>
      <Property name=’maxLength’ value=’3’>
   </Display>
   <Derivation>
      <or>
      <cond><eq>
      <ref>lenOfficePhone</ref>
         <s>8</s></eq>
         <s> </s></eq>
      </cond>
      <cond><eq>
         <ref>lenOfficePhone</ref>
            <s>12</s></eq>
               <substr>
               <ref>Office Phone</ref>
               <i>0</i>
               <i>1</i>
               </substr>
      </cond>

      <cond><eq>
         <ref>lenOfficePhone</ref>
         <s>14</s></eq>
            <substr>
               <ref>Office Phone</ref>
               <i>0</i>
               <i>1</i>
            </substr>
      </cond>
      </or>
   </Derivation>
</Field>

When you are calculating fields, you must consider the data’s current format and quality in the resource. It is much easier to ensure the correct field values when creating new users. It is much harder to get existing data to conform to the field when reading it off the resource. You can use derivation rules for any field to check the format of the attribute as it is being read in.