Index
OnExitSet
Video Courses
Watch structured video courses
Knowledge Base
Visit our User Forum for discussions & solutions
OnExitSet
Set the value of a data element on your XpressDox template
The «OnExitSet()» command permits a template author to specify that, when a control on the interview (the trigger) loses focus, the value of another or the same data element (the target) can be set, cleared, or modified. The caption, footing, or heading of the target can also be changed. If the data element does not exist before the interview is run, it is created at the point that the OnExitSet executes.
Syntax and parameters:
«OnExitSet(TriggerElement,TargetElement,Action,Condition,TrueValue,FalseValue,EmptyCheck)»
| Parameter | Description |
|---|---|
| TriggerElement | The data element whose control in the interview governs this feature. When focus leaves the control, the relevant target is set. |
| TargetElement | The data element whose value is to be set or deleted (or whose Caption, Heading, or Footing is to be set). |
| Action | What to set on the target: Value, Caption, Footing, Heading, FootingText, or Delete. |
| Condition | A condition which must be tested. Use () to apply the action unconditionally. |
| TrueValue | The value to assign to the target when the condition evaluates to true (or always, if no condition is used). |
| FalseValue | The value to assign to the target when the condition evaluates to false. |
| EmptyCheck | Controls whether the target is updated even if it already has a value: OnlyWhenEmpty or EvenWhenNotEmpty. |
The “Action” parameter:
The third parameter tells the OnExitSet what to set on the target data element:
| Action | Description |
|---|---|
| Value | Sets the value of the target data element. |
| Caption | Changes the caption displayed next to the field on the interview. |
| FootingText | Targets the footing text of a data element i.e. the text below the field |
| HeadingText | Targets the heading text of a data element i.e. the text above the field |
| HelpText | Targets the hover help of a field |
| DisplayText | Targets display text i.e. text which appears after ~~ in checkboxes or lists |
| Delete | Clears the target data element from the interview when the trigger loses focus. Removes what the user previously typed or selected, leaving the field blank. |
Examples:
Example 1: Set the value of a data element
«Comment(set the last name of the spouse to the same last name as the client)»
«OnExitSet(Client_LastName,Spouse_LastName,Value,(),Client_LastName,,OnlyWhenEmpty)»
Note that there may be cases where you may want to set the values of data elements but then not necessarily make them visible on the interview. You could then use InterviewRelevance or HideInsideIV for data elements that do not need to be visible.
Example 2: Change the caption of a data element:
«ChooseFromHzRDBList(PartyType,Individual,Entity)»
«PartyType»
«RefNumber»
«OnExitSet(PartyType,RefNumber,Caption,(PartyType = 'Individual'),'Social Security Number','Company Number')»
Note that when changing a caption, the initial caption on the control must be made wide enough to contain any of the values to which it might be set during the execution of OnExitSet commands. The initial caption can be padded on the right with spaces (or on the left if the AlignCaptions(Right) command is in effect) by the template author in order to make it long enough.
Example 3: Change footing text and the value of a radio button:
«Comment(this snippet calculates the current age from the given date of birth, both in footing text on the XpressDox interview, as well as in an Age field)»
DOB: «DOB»
Age: «Age»
Minor/Adult: «Adult»
«Comment(some standard footing text)»
«Footing(DOB,|@Blue@Enter the Date of birth)»
«Footing(DOB, )»
«Footing(Age,|@Blue@The age will be calculated from the date of birth)»
«Comment(Calculate the age and display it in footing text)»
«OnExitSet(DOB,DOB,FootingText,(),Concat(‘ Age rounded down in years: ‘,Floor(YearsBetween(Today(),DOB))),,EvenWhenNotEmpty)»
«Comment(Calculate the age and display it in the Age field)»
«OnExitSet(DOB,Age,Value,(),Floor(YearsBetween(Now(),DOB)),,EvenWhenNotEmpty)»
«Comment(is this person an adult or a minor)»
«OnExitSet(Age,Adult,Value,(Age < 18),’N’,’Y’,EvenWhenNotEmpty)»
«Comment(some additional commands required)»
«ChooseUsingDatePicker(DOB)»
«ChooseFromHzRDBList(Adult,,Y~~Yes,N~~No)»
«Caption(DOB,Date of birth)»
Example 4: Delete values.
«Comment(Clear CompanyName and CompanyNumber when the PartyType = Individual)»
«ChooseFromHzRDBList(PartyType,Individual,Entity)»
«CompanyName»
«CompanyNumber»
«OnExitSet(PartyType,CompanyName,Value,(PartyType = ‘Individual’),delete,,EvenWhenNotEmpty)»
«OnExitSet(PartyType,CompanyNumber,Value,(PartyType = ‘Individual’),delete,,EvenWhenNotEmpty)»
Note: You could consider putting OnExitSets on a button.