Text Functions in Expressions

Expressions can be used to display calculated text as well as numeric values. For example, you might use the Concat() function to join the value of a tag or the result of a calculation to a sentence.

A few of the string handling functions in VTScada are as follows. See String And Buffer Functions for complete descriptions of these and other functions. (Note: many string functions cannot be used in Steady State, and thus cannot be used in an expression.)

\GetPhrase & \GetParmPhrase

Note the backslash that begins each of these functions.

Given a phrase key, or a parameterized structure (\ParmPhrase) of phrase keys, this will return the matching phrase(s) in the current language.

Concat(a, b, c…)

Concatenates any number of sub-strings into one sentence. Works in only one language at a time.

Concat("Level of Tank 1: ",[TankLevel_1], "%")

Returns (for example): "Level of Tank 1: 30.35552%"

Concat(" Viewing Station: ", StationNumber)

Example shows how to set the title of a parameterized page, where StationNumber is a text or numeric parameter of that page.

Format(width, precision, value)

Turns a numeric value into a text string, having the specified width and precision (number of decimal points).

Format(5, 2, [TankLevel_1])

Returns (for example): "30.36"

Replace(sentence, start, length, find, replace)

Searches the sentence, starting at the Start character and continuing for Length characters, looking for every instance of Find and replacing it with Replace. Note that character counting begins with 0.

Replace("This is good", 1, 12, "is", "was")

Returns: "Thwas was good"

(Note that every instance of "is" is replaced. This may have unintended consequences.)

SubStr(sentence, start, length)

Returns a substring of Sentence, beginning with the Start character and running for Length characters.

Substr("on a Halifax pier", 5, 7)

Returns: "Halifax"