Index
Tutorial Videos
Tutorial videos are available here.
Knowledge Base
Visit our User Forum for discussions & solutions
Provide default values in the interview
Setting default options in an XpressDox interview
Often there is a need (for you as template author) to require that the user provide values for data elements, but that those data elements usually have the same value from one template run to another, and only change for exceptions. That means that you would like the system to provide the user with default values, but allow the user to change them for any specific situation.
An example of such default values would be a discount percentage, or an amount such as a consultation fee. A typical paragraph in a template might then read:
The fee for this consultation is $«FormatNumber(ConsultationFee)»
, but a discount of «DiscountPercent»
% will be applied if the account is settled in full within 14 days of receipt hereof.
When a template with this paragraph is run, then the user will be presented with capture fields for ConsultationFee and DiscountPercent, but by default both of these fields will be empty.
Providing default values for those fields would be achieved as follows (assuming the default for the fee of $450 and the discount as 10%):
Low Code: Use the Question command (v14 onwards):
The Question command accommodates initial values. Provide initial values for each of your Questions (ConsultationFee and DiscountPercent) as indicated below.
The fee for this consultation is $«Question(ConsultationFee,Enter the consultation fee,Number,,,,,FormatNumber(<~>,'#,##0.00'),automatic,450)»,
but a discount of «Question(DiscountPercent,Enter the discount percentage,Number,,,,,FormatNumber(<~>,'0.00'),automatic,10)» % will be applied
if the account is settled in full within 14 days of receipt hereof.
Note: The remainder of the suggestions are aimed more at Full Code solutions.
Include a text file
a. Create a text file which has two lines in it, and looks like this:
ConsultationFee,DiscountPercent
450,10
b. Save the file in the same folder as the template, and call it Defaults.xdtxt.
c. In the template itself, put the following command in a paragraph by itself:
«IncludeFileData(Defaults.xdtxt,norefresh)»
Those defaults (i.e. $450 and 10%) will be applied when the template is run with “New Data”.
The “norefresh” parameter ensures that when the data set for this template are used subsequently, the default data from the defaults file will not be refreshed in the data set. For a fuller explanation of “norefresh”, please see Get information from a data source and also Control how the user can change data source data .
A note about text files: these can be created using NotePad, or even Microsoft® Office Word. When creating a text file in Word, type the file as you normally would, and then save it using the “Save As” feature, and choose “Plain Text (*.txt)” in the “Save as type” drop-down box.
The file Defaults.xdtxt could be saved, not in the template folder, but in a Helper Folder (see Configuring Helper folders). Suppose the alias for this Helper Folder is lookups, then the fillpoint would read «IncludeFileData(lookups:Defaults.xdtxt,norefresh)»
.
The SetInitialValue command
Even though the SetInitialValue command can be used to code the default values in the template itself, but the above mechanism using IncludeFileData allows the default values to be changed without the need to change the template. This is particularly useful in the situation where a number of templates share the same data elements with the same default values. In that case changing the default values in the included text file will apply those default values in all including templates.
The Set command
The Set command is a more rigid way of setting default values in the interview. The values cannot be changed by the user unless you specify in the template that they should be allowed to. Perhaps you want to set default values for billing rates. The snippet below demonstrates how values can be set but greyed out.
«ChooseUsingCheckbox(Revise_rates,Y~~Revise fee earner rates,N,N)»
«Caption(Revise_rates,@@)»
«Comment(the fee earners)»
«FormatNumber(Joe)»
«FormatNumber(Sam)»
«FormatNumber(Patrick)»
«FormatNumber(Melissa)»
«Comment(for the interview. Put the fields in horizontal groups and make them read only unless the user checks the checkbox)»
«HzGroup(Joe,Sam)»
«HzGroup(Patrick,Melissa)»
«ReadOnly(Joe,Sam,Patrick,Melissa,(Revise_rates = ‘N’))»
«Comment(Set default values for the fee earners)»
«Set(Joe,(Joe = ‘’),500)»
«Set(Sam,(Sam = ‘’),560)»
«Set(Patrick,(Patrick = ‘’),490)»
«Set(Melissa,(Melissa = ‘’),510)»
«CaptureAllDataElements(Yes)»