Difference between revisions of "Choice menu user input"
Line 9: | Line 9: | ||
# Show the definition of the variable as a list, either in the ''Attribute ''view or the '''Object '''window. | # Show the definition of the variable as a list, either in the ''Attribute ''view or the '''Object '''window. | ||
# Click the '''''expr '''''menu and select the '''Choice '''option. Click '''OK '''to the question “''Replace current definition with a Choice?''” and click '''OK '''again to “''Replace current definition?''” when prompted. <br /> [[File:Chapter9 7.png]] | # Click the '''''expr '''''menu and select the '''Choice '''option. Click '''OK '''to the question “''Replace current definition with a Choice?''” and click '''OK '''again to “''Replace current definition?''” when prompted. <br /> [[File:Chapter9 7.png]] | ||
− | # The '''Object Finder '''dialog displays with parameter | + | # The '''Object Finder '''dialog displays with parameter <code>I = Self</code> and <code>n = 1</code>. Click '''OK'''. |
The definition field of the original variable now displays as a popup menu, and in browse mode, the input node displays as a popup menu. The original definition (list of numbers or labels) is now available as the '''''domain '''''of the variable — the possible outcomes. In the expression view, the popup menu displays as the [[Subscript and slice of a subarray|Choice() function]] | The definition field of the original variable now displays as a popup menu, and in browse mode, the input node displays as a popup menu. The original definition (list of numbers or labels) is now available as the '''''domain '''''of the variable — the possible outcomes. In the expression view, the popup menu displays as the [[Subscript and slice of a subarray|Choice() function]] | ||
− | <tip title="Tip">To define ''Var1 ''as a popup menu of another variable ''Var2'', that is defined as a list, select '''Choice''' from the '''''expr '''''menu, and set the first parameter to | + | <tip title="Tip">To define ''Var1 ''as a popup menu of another variable ''Var2'', that is defined as a list, select '''Choice''' from the '''''expr '''''menu, and set the first parameter to <code>I = Var2</code> in the '''Object Finder '''dialog).</tip> |
− | <tip title="Tip">To hide the '''All '''option on the popup, enter | + | <tip title="Tip">To hide the '''All '''option on the popup, enter <code>inclAll = False</code> as the third parameter in the '''Object Finder '''dialog.</tip> |
'''Creating a new definition''': If a variable has no previous definition, when you select '''Choice '''from the '''''expr '''''menu, a domain (possible outcomes) is created with a list of ''Explicit Values'', with one element in the list. | '''Creating a new definition''': If a variable has no previous definition, when you select '''Choice '''from the '''''expr '''''menu, a domain (possible outcomes) is created with a list of ''Explicit Values'', with one element in the list. |
Revision as of 20:50, 28 December 2015
For the classes of nodes that can be used for parametric analysis, such as decision and variable, the expr menu includes the Choice option. The Choice option provides a way to offer the user a choice of selecting one or all values from a list.
Creating a menu from a list: If the original variable is already defined as a list of numbers or labels, create a popup menu to select from the list as follows:
- Show the definition of the variable as a list, either in the Attribute view or the Object window.
- Click the expr menu and select the Choice option. Click OK to the question “Replace current definition with a Choice?” and click OK again to “Replace current definition?” when prompted.
- The Object Finder dialog displays with parameter
I = Self
andn = 1
. Click OK.
The definition field of the original variable now displays as a popup menu, and in browse mode, the input node displays as a popup menu. The original definition (list of numbers or labels) is now available as the domain of the variable — the possible outcomes. In the expression view, the popup menu displays as the Choice() function
I = Var2
in the Object Finder dialog).inclAll = False
as the third parameter in the Object Finder dialog.Creating a new definition: If a variable has no previous definition, when you select Choice from the expr menu, a domain (possible outcomes) is created with a list of Explicit Values, with one element in the list.
To change the domain to List of numbers, press the Domain value type popup to the right of the Explicit Values pop-up and select Numbers.
Edit the list of values as you would edit a list of labels or list of numbers.
Note: The values in the domain are evaluated deterministically.
Enable comment auto-refresher