NextGen Knowledge Center

SUBF$ Function

Use:Required when ASSIGN, CONFIRM, INPUTBOX, or PICKARRAY function parameters are used for the true/false values in the IFELSE Function. The addition of this subfunction ensures that the IFELSE function is evaluated correctly and returns the valid true or false value.
Syntax:
{IFELSE( «condition» , {SUBF$( «function» )$}, {SUBF$( «function» )$},)}
Arguments:

{SUBF$( «function» )$} 
«function»
    ASSIGN, CONFIRM, INPUTBOX, or PICKARRAY function
$ symbols
    Used internally to ensure that the subfunction is evaluated correctly within the IFELSE function 
Returns:The true or false value based on the condition and function type
Example 1:The ASSIGN function assigns a source value to the destination field(s) or variable(s).
{IFELSE( {{template_name_.inputfield}=1 , {SUBF$( {ASSIGN("value 1" , {template_name_.field1}, {template_name_.field2})} )$}, {SUBF$( {ASSIGN("value 2" , {template_name_.field3}, {template_name_.field4} )} )$} )}

Result: If 1 is entered in the input field, value 1 is assigned to template fields 1 and 2. If a value other than 1 is entered in the input field, value 2 is assigned to template fields 3 and 4.

Example 2:The CONFIRM function displays a window with a user-defined confirmation message and Yes and No buttons.
{IFELSE( {template_name_.check box} = 1, {SUBF$({CONFIRM( {"Overwrite the existing value?", "Previous Entry", WARNING, template_name_.inputfield != ""})$}, {SUBF$({CONFIRM( {"Do you want to add a value?", "New Entry", QUESTION, template_name_.inputfield = "")})$})}

Result: If a checkbox with a value of 1 is selected, and a value is changed in the input field, a window opens a warning message that the existing value will be overwritten. If a different checkbox or no checkbox is selected, and the input field is empty, a window opens a message questioning whether a value should be added. In either case, the user must respond by selecting the Yes or No button.

Example 3:The INPUTBOX function displays a custom window to gather input from the user. The input box may include a picklist of available options.
{IFELSE( {template_name_.inputfield} = 0, {SUBF$({INPUTBOX( "What is your marital status?", "Marital Status", "Single", @maritalstatus)})$}, {SUBF$({INPUTBOX( "What is your employment status", "Employment Status", "Working full-time", @employmentstatus)})$})}

Result: If 0 is entered in the input field, an input box displays with picklist values from the @maritalstatus array. If a value other than 0 is entered in the input field, an input box displays with picklist values from the @employmentstatus array.

Example 4:The PICKARRAY function displays the values of an existing Array variable in a picklist for user selection.
{IFELSE( {template_name_.inputfield} = 0, {SUBF$({PICKARRAY( @vitamins, "Vitamin Use", 1, "None")})$}, {SUBF$({PICKARRAY( @drugs, "Prescription Drug Use", 1, "None")})$})}

Result: If 0 is entered in the input field, a picklist displays with sorted values from the @vitamins array. If a value other than 0 is entered in the input field, a picklist displays with sorted values from the @drugs array. If no selection is made, the default value of None is used.

SUBF$ Function