ParameterEnumeration
The ParameterEnumeration attribute holds the list of possible values for a function parameter that gets displayed by Expression Assist. The value does not have any impact on how a parameter is evaluated or when errors are reported -- it is used solely for providing suggestions while someone it typing an expression.
Enumerated values
Some function parameters have a list of possible values that they accept. We say that such a parameter has an enumerated list of values. For example, the «part» parameter of the DatePart function can take values such as "Y"
or "MMMM"
that indicate what part of the date you want. Expression Assist helps you remember these by showing you suggestions
The Expression Assist popup shows the possible values, along with some documentation for each value. You can use the arrow keys to select or the mouse to click on a value in the Expression Assist popup, which inserts the value into the definition that you are typing.
Specifying for a user-defined function
You may want to provide the ParameterEnumeration information for one or more parameters of your own User-Defined Function (UDF). When you do this, then Expression Assist can provide the popup suggestions for values later while you are typing a call to the function.
By default, the ParameterEnumeration attribute is not visible in the Object window or Attribute panel. Thus, before you can edit it, you need to make is visible using these steps:
- From the menu, go to Object → Attributes... → class: Functions.
- Double click on Parameter Enumeration to turn on a check mark next to it.
- Press OK
- Open the Object Window for your UDF.
The ParameterEnumeration attribute should now be visible. Since this attribute is not of direct interest to users of your model, it is best to turn off visibility of this attribute after you've finished you edits. Leaving it non-visible avoids an unnecessary distraction when others are browsing your model.
Syntax
The parameter must adhere to a strict syntax of the following form:
param1Name val1|description val2|description ⁞ valM|description param2Name val1|description val2|description ⁞ valN|description ⁞
You only list the parameters that are enumerated, but you may have more than one. The parameter name appears as the only word on the line, while the values that follow are always followed by a pipe character (|
). The description of each value is optional, but the pipe character must be there. Here is an example for a single parameter named buttons
.
buttons 0|OK only 1|OK and Cancel (default) 2|Abort, Retry and Ignore 3|Yes, No and Cancel 4|Yes and No 5|Retry and Cancel
Notes
- The enumerations for built-in functions are in the
Analytica.ini
file, located in the Analytica install directory. - Once you turn on ParameterEnumeration in the Object Window, you can view the ParameterEnumeration for a given built-in function by bringing up its Object Window by selecting it from the Definition Menu.
History
Introduced in Analytica 4.5.
Enable comment auto-refresher