Difference between revisions of "Error Messages/40616"

Line 5: Line 5:
 
= Cause  =
 
= 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.
+
You are trying to assign a value to a slice (subscripted element) of a global variable. This is not permitted, since it would contravene Analytica's general principle of ''no side-effects''.  You may assign to a slice of a local variable.
  
The following scenario would trigger this error. Here Object2 is assigning to a slice of the global variable object, Object1.
+
This example triggers this error. Here Object2 is assigning to a slice of the global variable object, Object1.
  
 
Definition of Index1:<br>
 
Definition of Index1:<br>

Revision as of 22:15, 16 August 2011

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 (subscripted element) of a global variable. This is not permitted, since it would contravene Analytica's general principle of no side-effects. You may assign to a slice of a local variable.

This example triggers 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 definition of X when V is defined as ComputedBy(X). Here is a link to the documentation of function ComputedBy.



You are not allowed to post comments.

Comments
<comments />