Related topics:


Tutorial Videos

Tutorial videos are available here.

Knowledge Base

Visit our User Forum for discussions & solutions

OnExitSet – XpressDox

Set the value of a data element on your XpressDox template

«OnExitSet()» permits the 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, caption, footing or heading can be set.  If the data element does not exist before the interview is run, then it is created at the point that the OnExitSet executes.


Command syntax:


  • When the focus leaves the Client_LastName control on the interview (the trigger), then the Spouse_LastName data element (the target) will have its value  set (the 3rd parameter in the command– it could also be Caption, Footing or Heading, the functioning of which is self-explanatory).
  • The value will be set to Client_LastName i.e. Spouse_LastName will receive the same value as Client_LastName.
  • This setting of values can happen conditionally; copy this fillpoint into Word and then click Edit Fillpoint to look at the parameters.
  • The last parameter can be either OnlyWhenEmpty or EvenWhenNotEmpty, so that in this example, the Spouse_LastName will be set to the value of Client_LastName but only if the Spouse_LastName data element is empty when the Client_LastName field loses focus.  If the user changes the value of Client_LastName, then Spouse_LastName will also be updated when the focus leaves Client_LastName again.


Further examples:

«Comment(change the caption of a data element with OnExitSet)»
«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.

    «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)»
    «Comment(is this person an adult or a minor)»
    «OnExitSet(Age,Adult,Value,(Age < 18),’N’,’Y’,EvenWhenNotEmpty)»
    «Comment(some additional commands required)»
    «Caption(DOB,Date of birth)»


    Note that this feature is available only in Version 4 and later of XpressDox.

    Note further that with effect from version 4.3 of XpressDox, this feature works slightly differently with checkboxes, radio button lists, ChooseFromDataSource, and drop down lists with fixed values (i.e. not those created for ChooseFromSamples): in these cases the setting of the value/caption/heading/footing occurs not when the control loses focus, but when the user chooses a value from the control. This seems to be more intuitive in these instances.