Difference between revisions of "Error Messages/40018"
AManandhar (talk | contribs) |
|||
Line 1: | Line 1: | ||
− | + | [[Category: Error messages]] | |
− | + | == Error message examples == | |
− | + | :<code>''You can only assign to a local variable. X is not a local variable.''</code> | |
− | This error is caused when a global variable is assigned inside another variable definition. You can only assign values to local variables defined by using var inside the definition. | + | == Cause == |
+ | |||
+ | This error is caused when a global variable is assigned inside another variable [[definition]]. You can only assign values to [[Local Variables|local variables]] defined by using <code>var</code> inside the definition. | ||
Changing the value of the global variable inside another variable is, generally, not a good practice. | Changing the value of the global variable inside another variable is, generally, not a good practice. | ||
− | = Remedies = | + | == Remedies == |
− | |||
− | |||
− | One way to get around this issue is to use a Button which can have side effects and can assign to global variable. [[Scripting|Scripts and Buttons]] are only available in Analytica Enterprise and higher. | + | One way to get around this issue is to use a [[Button]] which can have side effects and can assign to global variable. [[Scripting|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 | + | You can also assign to a global variable, <code>V</code>, from the definition of <code>X</code> when <code>V</code> is defined as [[ComputedBy]](X). |
− | + | ==See Also== | |
+ | * [[Assignment Operator :=]] | ||
+ | * [[Analytica_Script#Assigning_to_globals|Assigning to global variables]] | ||
+ | * [[Local Variables|Local variables]] | ||
+ | * [[Definition]] | ||
+ | * [[Buttons]] | ||
+ | * [[ComputedBy]] |
Revision as of 22:24, 9 March 2016
Error message examples
You can only assign to a local variable. X is not a local variable.
Cause
This error is caused when a global variable is assigned inside another variable definition. You can only assign values to local variables defined by using var
inside the definition.
Changing the value of the global variable inside another variable is, generally, not a good practice.
Remedies
One way to get around this issue is to use a Button which can have side effects and can assign to global variable. 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).
See Also
Comments
Enable comment auto-refresher