Loading API Index...
Open Automation Software API Documentation
Show / Hide Table of Contents

Calculation Engine Text Functions

The following are functions for evaluating or manipulating strings to be used in the OAS Calculation Engine:

ASCII to Integer

Converts ascii character to integer value.

Parameters:

  • Ascii character value to convert

Example:

ASCTOINT([Tag.Value])

Concatenation

Concatenate two string values and return the resultant string. While the same operator is used for logical AND operations, this operator expects the input of two strings. If one parameter is a string literal, the other will be converted implicitly, otherwise the operation may be interpreted as a boolean AND comparison. Wrap both values in STR() to force a string conversion.

Examples:

[Tag1.Value] & [Tag2.Value]
"The Value is: " & [Tag.Value]
[Tag.Value] & "gal/min"
STR([Tag1.Value]) & STR([Tag2.Value])

Contains

Returns true if string contains the second string parameter.

Parameters:

  • String to evaluate
  • String to check for

Examples:

CONTAINS([Tag.Value],"Check String")
CONTAINS("String to Evaluate", [Tag.Value])
CONTAINS([Tag1.Value],[Tag2.Value])

Ends With

Returns true if string ends with the second string parameter.

Parameters:

  • String to evaluate
  • String to check for

Examples:

ENDSWITH([Tag.Value],"Check String")
ENDSWITH("String To Evaluate", [Tag.Value])
ENDSWITH([Tag2.Value],[Tag2.Value])

Format Number

Converts a number to a string with the format of the second parameter. For valid format codes see Numeric Format Codes.

Parameters:

  • Number to convert.
  • String containing format codes

Examples:

STRFORMAT([Tag.Value],"c") // currency
STRFORMAT([Tag.Value],"e") // exponential notation
STRFORMAT([Tag.Value],"p") // percent

Index Of

Returns the 0-based position of first occurance of string to check for within the string to evaluate. The check is case-sensitive. Returns -1 if string cannot be found.

Parameters:

  • String to evaluate
  • String to check for

Examples:

INDEXOF([Tag.Value],"p")
INDEXOF([Tag.Value],[Tag.Value])
INDEXOF("String to evaluate",[Tag.Value])

Integer to ASCII

Converts integer to ascii character value.

Parameters:

  • Integer value to convert

Example:

INTTOASC([Tag.Value])

Replace

Returns a string with all occurrences matching the string value of parameter 2 replaced with the string value of parameter 3.

Parameters:

  • String to evaluate
  • String to search for
  • String to replace the occurrences found

Examples:

REPLACE([Tag.Value],"Old String","New String")
REPLACE("String to evaluate",[Tag.Value],"New String")
REPLACE("String to evaluate","Old String",[Tag.Value])
REPLACE([Tag1.Value],[Tag2.Value],[Tag3.Value])

Starts With

Returns true if string starts with the second string parameter.

Parameters:

  • String to evaluate
  • String to check for

Examples:

STARTSWITH([Tag.Value],"Check String")
STARTSWITH("String To Evaluate", [Tag.Value])
STARTSWITH([Tag2.Value],[Tag2.Value])

String

Converts a number to a string. Useful for passing numbers into other string comparison and conversion functions.

Parameters:

  • Number to convert

Example:

STR([Tag.Value])

String Length

Returns the length of a string.

Parameters:

  • String to evaluate

Example:

STRLEN([Tag.Value])

Substring

Returns a substring of a string.

Parameters:

  • String to evaluate
  • 0-based starting position within the string
  • Number of characters to capture

Examples:

SUBSTR([Tag.Value],0,1) // first character
SUBSTR([Tag.Value],3,10)
SUBSTR("String to evaluate",[Tag1.Value],[Tag1.Value])
Back to top Copyright (c) Open Automation Software. All rights reserved.