Error Messages/41161


Message text

The value being assigned to Va1 contains more than one implicit index.

Cause

A multi-dimensional Analytica array is allowed to have at most one implicit dimension. All other dimensions are associated with explicit indexes. Explicit indexes are index objects, complete with an index name, object and attributes. An implicit dimension has no associated object or name. Only one is allowed, because if there were more than one, there would be no way to refer to one or the other.

Implicit indexes arise when lists are combined with other values. For example, the expression:

(1..5)^2

creates a list with 5 elements, which is the same thing as a 1-D array with one implicit dimension. If you wanted to sum the elements, you would not be able to name the index. However, you could write:

Sum((1..5)^2)

with no index parameter. Without the index parameter, it is understood that you intend to sum over the implicit dimension.

If you use the Var..Do syntax to define a local variable as a list, you may be able to temporarily introduce multiple dimensions into the same array that have no associated index object. For example:

Var I := 1..5;
Var J := Sequence(10, 90, 10);
Var A := I + J;
...

Here we have created a 2-D array A, where both dimensions are only semi-explicit. Neither has an associated index object. Once I and J fall out of lexical scope, the can no longer be named, so that both will become implicit indexes.

This error occurs when you do something like:

Var I := 1..5;
Var J := Sequence(10, 90, 10);
Va1 := I + J
...

The assignment to the global Va1 requires either that Va1 is defined as ComputedBy(Z), where «Z» is the current variable, or that the above expression is being evaluated from a button script or a User-Defined Function called directly from a button script. In those circumstances, the assignment to global Va1 is allowed. In this case, when the array (I+J) is assigned to Va1, both I and J are no longer in lexical scope inside Va1, so both dimensions are converted to be implicit, which is then disallowed.

Remedies

To avoid this, you need to use explicit indexes, which you can do by declaring I and/or J via Index..Do, as in:

Index I := 1..5;
Index J := Sequence(10, 90, 10);
Va1 := I + J
...

If you leave one implicit index in the result, that dimension will be promoted to be the self-index of Va1.

See Also

Comments


You are not allowed to post comments.