Parameter Usage Within the Calculator

You can use parameters in the Calculator component

The following topics are discussed:

Related Topics
Entering and Evaluating Expressions
Editing Expressions

Parameter Limitations

There are some limitations when you are working with parameters in the Calculator component.

Parameter names that contain only letters and numbers (and do not start with a number) can be typed in directly. Other parameter names must be surrounded by single quotation marks. If the parameter name contains a single-quote character, add another quotation mark (e.g., 'Don''t').

Elements of multi-dimensional arrays can be referenced as array[i][j] or as array[i, j].

Members of aggregate parameters can be referenced using dot notation: agg.member. Aggregates and arrays can be combined: agg.arr[i, j].

When referencing a member of an aggregate where the aggregate parameter name or the member name contains punctuation, you can put single quotation marks around the entire name (e.g., 'agg with space.mem with space') or separately around each portion (e.g., 'agg with space'.'mem with space').

Note: Parameters and functions can have the same name because function names are followed by an open parentheses, and parameter names are not.

Undeclared Parameters

The Calculator component supports undeclared parameters.

Any parameter name used in the calculation is created as a parameter when you click Calculate, Apply, or OK. Isight attempts to determine the correct mode (input, output, in/out, or local) of the parameter, data type (real, integer, or string), and structure (scalar, array, or aggregate) based on how the parameter is used. If there is insufficient information to determine the data type and structure, Isight creates a real scalar parameter.

When you click OK to close the Calculator Component Editor, each parameter’s mode is updated to reflect how the parameter is used in the calculation as follows:

  • If the parameter is assigned, the mode becomes output.

  • If the parameter is referenced, the mode becomes input.

  • If the parameter is referenced and then assigned, the mode becomes In/Out.

Isight follows these rules to ensure that existing parameter mappings are not broken.

Parameters are created as arrays when:

  • used with subscripts (A[i, j]),

  • used as an argument to a function that only accepts arrays as the argument (max(A)), or

  • directly assigned to or from an existing array (A = myArray; myArray = B).

If explicit subscripts are used, the size of the array is set to the largest subscript specified (plus one) or to the size of the existing array. If the array size cannot be determined, the Calculator Component Editor prompts for the array size.

Important: The Calculator component cannot recognize when a function that accepts scalar or array arguments would return an array. Therefore, it is recommended that you create parameters using the collapsed mode of the Calculator Component Editor or by using the Design Gateway Parameters tab.