Reusing chart expressions
We have mentioned this previously. If you need to do repeated calculations, it is better to do these in the script and create extra fields there. However, there are times when this may not be possible. One way that would appear to solve this issue when using a Chart object is to use a previously calculated Label expression in other expressions.
On the surface, this would appear to be more efficient, and it certainly makes the script easier to read; in practice, there is no speed advantage, and in most tests, it works slightly more slowly. It is, therefore, more efficient to duplicate this part of the expression again.
Have a look at this simple example:
Here, to show the TAX
figure, we will use the following expression:
However, it would be more efficient to use this expression instead:
=Sum([Line Qty] * Price) * 0.2