Defining Output Variables
States return results as output variables, which are always session variables. Only states can set output variables, and only at runtime. Output-variable check boxes are always selected and cannot be modified.
To create an output variable, use the OutputAttribute
constructor:
OutputAttribute("WEATHER", "Your Weather Synopsis")

By default, output session-variable names are not set, so text boxes are empty. You can
set values by calling either of these two methods:
- setValue – creates a session variable (if none exists), and saves the value immediately in the database, or,
- setHoldValue – temporarily holds the value in the cache, until you explicitly call the SmappStatePlugin::saveOutputAttributes method.
The saveOutputAttributes method saves multiple session variables with a single database connection. If the state has only a few output variables, call the setValue method. If there are many output variables, call setHoldValue; this may impact the efficiency of the state at runtime.
To set output variables, call one of the methods in the
OutputAttribute class:
- public void setValue (String val)
- public void setValue (Long val)
- public void setValue (Integer val)
- public void setValue (Boolean val)
- public void setHoldValue (String val)
- public void setHoldValue (Long val)
- public void setHoldValue (Integer val)
- public void setHoldValue (Boolean val)