Variable

Top  Previous  Next

Most of the Analysis Tools in Vensim operate on the Workbench Variable.  The Variable tab of the Control Panel is used to select the Workbench Variable.  The Workbench  Variable can also be selected by double clicking on the variable name in any Output or Build window.

The list at the top contains all variables that match your selection criterion.  By default this is a list of all regular variables in a model, but you can also search for partial name matches, and by type of variable.  To select a variable into the workbench:

Click on any name in the list, or
Type part or all of the name of a variable in the Name or Pattern field until the variable appears in the list, then press the Enter key.
Type in a complete name and then click on the Exact button to select the name you have typed.  This is useful if there are many names that start the same.

Name or Pattern lets you enter the beginning of names, or wildcard strings using *  to match any number of letters and ? to match one letter.  For example *labor* finds all variables that include the string labor; *labor finds all variable names ending in labor; and labor* finds all variable names beginning with labor.  When you type a name with a wildcard and press Enter or click on select, only names that match the pattern you entered are displayed, and all types of variables are searched.

NOTEAs you begin to type into the Name or Pattern field, the first name in the list that matches what you are typing is automatically selected.  Clicking Select or pressing Enter will cause the highlighted name to be selected in to the workbench.  Once you enter a * or ? in the name you are typing the currently selected item in the list will no longer change.

Subscripts allows you to specify the complete set of subscripts for the Variable you are choosing and is active only for subscripted variables.  Normally, if you select a subscripted variable name such as Cum Cost without specifying any subscripts, the title bar will change to:

The Subscript Control, described later in this chapter, can then be used to control tool output.  If, however, you are interested in looking only at TASK2, click on the down arrow to the right of Subscripts

and click on [TASK2].  The variable Cum Cost[TASK2] will go into the workbench and this variable will be used by the Analysis Tools independent of the settings in the Subscript Control.

If you simply type in the name of a Subscript Element and that Element is valid for the Workbench Variable, then the Workbench Variable will be changed to use that element.  For example, typing or selecting TASK3 when the Workbench Variable is Cost[task] would change the Workbench Variable to Cost[TASK3].   Typing in the name of a Subscript Range does not have this effect (see the discussion below).

Type allows you to select variables by type.  When you click the down arrow at the right, you see a list of the possible variable types.  When you select a variable type, only variables of the selected type appear in the list.  

In addition to the normal variable types, Type allows you to select the Subscript Ranges and Groups.  Selecting by Type is the only way to fill the list with all Subscript Ranges or Groups.  When you use wildcard searches, Subscript Ranges and Groups will not be displayed.

If you select a Group (either by choosing Type  group and selecting a group from the list or by directly typing in the name of a group) the list is filled with all variables belonging to that Group.  The Workbench variable will not be changed.
If you select a Subscript Range (from the list or by typing it) the list will display all variables that use the selected Subscript Range.   The Workbench variable will not be changed.

Exact attempts to select exactly what you have typed in the Name or Pattern field.  This can be helpful if, for example, you just want to be sure that the model does not have a variable called work.  As you type work, work accomplished might be selected in the list even though this is not what you want.  Since the list can be filtered, or displaying a specific variable type, the Exact button is the best way of determining whether or not a variable exists.

Select sends all information in the Name or Pattern field to the Workbench.  Double-clicking a name in the list is equivalent to highlighting a name and clicking Select.  Pressing the Enter key has the same effect as clicking the Select button.  If you have typed part of a name and a match has been found in the list, clicking on Select or pressing Enter will place that match into the Workbench.

When you select a variable into the Workbench the titlebar will change.  If you attempt to select something into the Workbench that is not a variable name nothing will happen.

NOTE Selecting a variable into the Workbench replaces the previous Workbench Variable.  Thus, you can only select one variable into the Workbench at a time.