Index-label dot syntax
New to Analytica 7.0
Analytica's Intelligent Arrays provide great flexibility in that you can modify, add ,or remove indexes (dimensions) and the existing Definitions will generalize automatically -- in most cases. Before Analytica 7.0, there was one exception. When an expression refers to a particular index value, such as:
IF Tech = "Solar" THEN 200 ELSE 900
and you change that value -- e.g. "Solar" to "PV" it would break this expression. In release 7.0 and after, it updates this expression automatically, since it realizes that "Solar" is a value of Index Tech.
But in some cases, the index associated with the value isn't obvious, so it can't do that automatically. Now you can tell it what Index, the text is a value of by using syntax:
Tech."Solar"
or more generally
<index> . <text literal>
This syntax consists of the identifier of an index, a dot, and a text literal (which can use single or double quotes).
Use this when your index (I) is a list-of-text index, and "label" is one of the index elements, and you express that this text literal needs to be the same as the index label.
The result of evaluating this construct is just "label". The association with the index does not impact equality -- i.e., even if two indexes, I and J are totally separate but both happen to have an element "label", I."label" = J."label" is still True.
The syntax provides two advantages:
- It tells Analytica that the text literal is the value in the index. If you later change the label in the index. Analytica will automatically rewrite this expression, replacing it with the new value. Hence, it helps avoid logical errors that can creep into a large model if you forget to update some expressions after changing an index label.
- During evaluation, it double checks that
"label"is indeed an element of the index. If not, it issues an evaluation-time warning. If you ignore the warning, the value is"label".
Enable comment auto-refresher