Error Messages/40616

Error Message Examples

You cannot assign to a slice or subscript of a global variable object.

Cause

You are trying to assign a value to a slice of a global variable which is not allowed. Objects in Analytica are not allowed to have side effects, and can only change the values of local variables defined with a Var.

The following scenario would trigger this error. Here Object2 is assigning to a slice of the global variable object, Object1.

Definition of Index1:
1..9

Definition of Object1:
Table(Index1)(7, 8, 3, 2, 5, 4, 9, 1, 5)

Definition of Object2:
Object[Index1 = 5] := 6

Remedies

One way to get around this issue is to use a Button which can have side effects and can assign to global variable slices. Scripts and Buttons are only available in Analytica Enterprise and higher.

You can also assign to a global variable, V, from the definitio of X when V is defined as ComputedBy(X). Here is a link to the documention of function ComputedBy.



You are not allowed to post comments.

Comments
<comments />