Error Messages/40122
Example Error Message
- The + operator or Sum() function was used with a text value. Use the & operator or the JoinText() function instead if your intention is to concatenate text.
The + operator cannot be used to concatenate text when multithreaded evaluation is enabled. In a future release, use of + or Sum for text concatenation will be disallowed entirely.
Description
Use the + operator for addition of numeric values. Do not use it to concatenate text values. If you want to concatenate text, use the & operator. Similarly, you should use Sum to sum numeric values, not for concatenation. JoinText is used to concatenate cells of an array textually.
Many programming languages use + for text concatenation, for example "Hello" + "World" → "HelloWorld". Although common, this is a bad design choice, since addition is commutative (i.e., [math]\displaystyle{ a+b = b+a }[/math]) whereas text concatenation is not.
Use & or JoinText:
"Hello" & "World" & rarr; "HelloWorld"JoinText( ["Hello", "World"] ) → "HelloWorld"
Deprecation and legacy models
In some circumstances, Analytica will still allow you to use + and Sum for text concatenation, but it issues a warning (unless you have disabled Show Result Warnings) advising you that this use is deprecated and will not be supported in future releases of Analytica. As of Analytica 5.0, it is still allowed as long as your model does not have multithreaded evaluation turned on. It does not allow & or Sum to be used for text concatenation when multithreading is enabled.
If you have a legacy model that uses + or Sum for text concatenation, the best option is to change the expressions to use & and JoinText instead. If you are not willing to change the model, then you should set MaxModelThreads to 1 to disable multithreaded evaluation for this model.
Enable comment auto-refresher