Defining Input Variables

States use input variables to get input values, either from a session variable or as a constant. You can configure the behavior in the state editor. The InputAttribute class manages input variables.

In addition to the basic properties, input variables have an isOptional property. If set to true, the input variable is optional; false indicates it is mandatory.

The input variable constructor is:
InputAttribute (String  id,  String  description, boolean isOptional)

Two types of input variables exist, text box input controls and selection input controls.

Text Box Input Controls

Text boxes manage either a single constant value or a value that is accessed from a session variable.


Text Box Input Controls

You can create the input variable in the example above using this constructor:
TextBoxAttribute( " POSTCODE " , " Zip or Postal Code " , false);

By default, the variable ID is automatically assigned to the TextBoxAttribute control. In this case, the ID is POSTCODE. The description, Zip or Postal Code, appears to the right. The red dot indicates that the input variable is mandatory.

Note: If input is mandatory and a session variable name is specified, a runtime error is thrown if the session variable does not exist. The processing engine terminates the application, unless the state implementation handles RequiredParameterMissingException, with either continueFail or continueDyn follow-up transitions.
The state of the check box tells the processing engine how to process an input variable:
  • Selected – retrieve the value from the named session variable.
  • Not selected – use the constant value.

If you use a state twice in the same application, and if the state saves a value in a session variable, change the session-variable name in the second instance, so it does not overwrite the value.

To find the session-variable name, hover the mouse over the description text; pop-up text includes the variable description and the variable name.

Selection Input Controls

Selection input controls manage constant values that are selected from a list of options. Lists are populated in the state code.


Selection Input Controls

Unique IDs are automatically assigned as the session-variable name; you cannot change them, and they do not appear in the state editor. To find the session-variable name, hover the mouse over the description text; pop-up text includes the variable description and the variable name.

To use a state twice in the same application, and save the value of the session variable, you can call the Copy Variables state to copy the session variable to another variable.

The check box performs the same function as it does for text box controls. The red dot indicates that an input selection is mandatory.

Related concepts
Input and Output Parameters
Custom State Variables
Defining Output Variables
Accessing Input Variables
List Variables