4.27 FAQ-386 How to avoid substitution in LabTalk?

Last Update: 2/4/2015

Variable with substitution notations, such as $, %, will be resolved to its actual value when the script is executed. This will cause trouble if you need the script run more than one time. To avoid this situation you can assign the special substitution notation to a String register instead of using it directly. For more details about substitution notations, please refer to this page.

Example:

The following script will set the formula in the Set Values dialog of Col (B) to Col(A)[i] - %(Col(B)[U]$) without letting %(Col(B)[U]$) be substituted by the Units value of Col(B).

%A="%";
csetvalue f:="Col(A)[i] - %A(Col(B)[U]$)" c:=Col(B);

Keywords:substitution, avoid substitution, turn off substitution