RecipeGetMessage() function
- Last UpdatedJun 17, 2024
- 1 minute read
The RecipeGetMessage() function takes an error number (returned by some other recipe function) and returns the plain text error message for that error number.
Category
Recipe
Syntax
RecipeGetMessage(Analog_Tag,Message_Tag,Number);
Arguments
Analog_Tag
Error number for which you want to get the error message.
Message_Tag
Actual message tag with no quotes or string literal.
Number
The Number argument sets the maximum length of the string returned with the Message_Tag argument. By default, InTouch message tags are set to the maximum length of 131 characters. Use 131 for this parameter unless you have reduced the maximum string length of Message_Tag in the InTouch Tagname Dictionary. The Number argument can be a constant or an integer tag containing a number.
Example
By using the RecipeGetMessage() function in an InTouch Data Change QuickScript, the error code is written to the ErrorCode tag and the associated error code message is written to the ErrorMessage tag:
Data Change Script Tagname[.field]:ErrorCode
Script body:RecipeGetMessage(ErrorCode, ErrorMessage,131);
This QuickScript automatically runs whenever the value of the ErrorCode tag changes. When this QuickScript runs, the RecipeGetMessage() function reads the current numeric value of the ErrorCode tag and returns the message associated with that value to ErrorMessageTag.
ErrorCode = RecipeLoad ("c:\App\recipe.csv","Unit1","cookies");
RecipeGetMessage(ErrorCode, ErrorMessageTag, 131);