Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 25 Next »

This page provides details on supported functions.

For information on the Evaluate Expression Tool, see How to Use Evaluate Expression.

On this page:

Supported Message Center (MC) Functions

MC Function: Atof

Format

atof( object[, decsep = '.'[, thoussep=',']] )

Arguments Types

object

 String

decsep - decimal separator

 String

thoussep  -  thousands separator

 String

Return Type

Double

Returns Value

  • Converts its first parameter object of type String to type Double, taking its second parameter decsep as decimal separator and its third parameter thoussep as thousands separator. If separators are indicated, then during conversion, these symbols are omitted, that is, not taken into consideration. The default value for parameter decsep is '.', for parameter thoussep – ','.

  • If parameters have types other than those needed, zero (0.0) is returned.

Examples

Expression

Result

atof('11123,456', ',')

11123.456

atof('11123,456')

11123456

atof('11.123,456', ',', '.')

11123.456

atof('11.123,456', ',')

0 (Cannot convert as the thoussep not defined)

atof('11.123,456',)

0 (Cannot convert as the thoussep and decsep not defined)

MC Function: Atoi   

Format

atoi( object )

Arguments Types

object

 String

Return Type

Integer

Returns Value

  • Converts its parameter object of type String to type Integer

  • If parameters have types other than those needed, zero (0) is returned

Examples

Expression

Result

atoi('11123')

11123

atoi('11123,456')

11123

atoi('abc')

0

MC Function: Atol  

Format

atol( object )

Arguments Types

object

 String

Return Type

Long

Returns Value

  • Converts is parameter object of type String to type Long

  • Of parameters have types other than those needed, zero (0) is returned

Examples

Expression

Result

atol('1231231231231231231')

1231231231231231231

atol('123123123123123,1231')

123123123123123

atol('abc')

0

MC Function: Convert  

Format

convert( object, p2[, p3[, p4[, p5[, p6]]]])

Arguments Types

object

p2

p3

p4

p5

p6

Return Type

String

Returns Value

  • If object is of type String, then it is returned unchanged no matter what values the other parameters include.

  • If object is of type Date, then p2 must have type String representing format, according to which object is represented as string.

Format can have the following special symbols:

  • If object is of type Time, then p2 must have type String representing format, according to which object is represented as string.

 
Format can have the following special symbols:

  • Object has one of numeric types Integer, Long, or Double.

    In this case, next types are assumed with their descriptions:

    • A conversion of numeric type to string type is attempted by:

      • Using a specified thousand separator, if any,

      • Using a decimal separator, if any,

      • Grouping thousands by a specified number, and

      • If the number is negative, inserting a negative sign in front of the number.

      • If the negative character is '(', and the number is negative, the resulting string is enclosed in parenthesis. Otherwise, an empty string is returned.

      • If the negative character is "(", and the number is negative, the resulting string is enclosed in parenthesis. Otherwise, an empty string is returned.

yyyy – Replaced with 4 digit year.
yy – Replaced with 2 digit year.
mm – Replaced with month number.
dd – Replaced with day in the month number.
hh – Replaced with number of hours.
mm – Replaced with number of minutes.
ss – Replaced with number of seconds.

p2 Integer Contains the number of the decimal.
p3 String Contains the decimal separator. If omitted, the default value \nis "."
p4 String Contains the thousand separator. If omitted, the default value is "" (empty string).
p5 Integer Contains the number of thousands to separate. If omitted, the default value is 3.
p6 String Contains a negative sign. If omitted, the default value is "-";

Examples

Expression

Result

convert(123456, 3, ".", ",", 3, "-")                                              

'123,456.000'

Default Value used (next 5 lines)

convert(-123456, 3, ".", ",", 3, "-")                                             

'-123,456.000'

convert(-123456, 3, ".", ",", 3)                                                  

'-123,456.000'

convert(-123456, 3, ".", ",")                                                       

'-123,456.000'

convert(-123456, 3, ".")                                                              

'-123456.000'

convert(-123456, 3)                                                                  

'-123,456.000'

convert(-123456l, 3, ".", "", 3, "(")                                             

'(123456.000)'

convert(-123456l, 3, ".", ",", -3, "(")                                          

'(123456.000)'

convert(-123456l, -3, ".", ",", 3, "(")                                          

'(123,456)'

convert(-56l, -3, ".", ",", 3, "(")                                                  

'(56)'

convert(1234567890.987654321, 3, ".", ",", 3, "-")                

'1,234,567,890.988'

convert(-1234567890.987654321, 3, ".", ",", 3, "-")               

'-1,234,567,890.988'

convert(-1234567890.987654321, 3, ".", ",", 3, "(")                 

'(1,234,567,890.988)'

convert(0.0000987654321, 3, ".", ",", 3, "-")                             

'0.000'

Default Value used (next 5 lines)

convert(1234567890.9, 4, "-", "_", 2, "-")                                   

'1_23_45_67_890-9000'

convert(-1234567890.9, 4, "-", "_", 2, "(")                                

'(1_23_45_67_890-9000)'

convert(-1234567890.9, 4, "-", "_", 2)                                       

'-1_23_45_67_890-9000'

convert(-1234567890.9, 4, "-", "_")                                          

'-1_234_567_890-9000'

convert(-1234567890.9, 4, "-")                                                 

'-1234567890-9000'

convert(-1234567890.9, 4)                                                      

'-1234567890.9000'

convert(-1234567890.987654321, 3, ".", ",", 3, "")                 

'-1,234,567,890.988'

convert(#12:15:45#, "hh/mm/ss")                                           

'12/15/45'

convert(today(), "yyyy/mm/dd")                                            

'2001/07/13'

convert(today(), "yy/mm/dd")                                                 

'01/07/13'

convert(today(), "Today is : dd-mm-yyyy")                              

'Today is : 13-07-2001'

convert(currentTime(), "hh:mm:ss.uuu")                                

'18:18:20.111'

convert("string", "hh:mm")                                                          

'string'

MC Function: CountStrings  

Format

CountStrings(countStringsObject, countStringsWhat, countStringsStart, countStringsHowMuch) 

Returns Value

Returns how many times string, specified by its 2nd parameter (countStringsWhat), occurs in the strings, specified by its 1st parameter (countStringsObject). Starting position is indicated by the 3rd parameter (countStringsStart) and the range of symbols within the search should be performed is defined by the 4th parameter (countStringsHowMuch).

Examples

Expression

Result

CountStrings("122333444455555", "55")

2

CountStrings("1223334444", "NEW")

0

MC Function: CreateVariable  

Format

CreateVariable( varName, varValue):

Returns Value

Assigns expression indicated as a second parameter (varValue) and stores it for further usage under the name that the first expression evaluates too (varName).

The assignment statement (:=) can also be used for creating a variable.

Examples

Expression

CreateVariable('var_1','123')

CreateVariable('var_2',:var_1:)

MC Function: CurrentTime   

Format

CurrentTime( )

Return Type

Time

Returns Value

Returns value of type Time for the current time in the format hh:mm:ss.uuu.

Examples

Expression

Result

CurrentTime()

01:41:59.035

MC Function: Date  

Format

Date( object,  format )

Arguments Types

object

 String

format

 String

Return Type

Date

Returns Value

  • Makes an attempt to convert the string that is contained in object using the format, to type Date.

  • The format string can contain the following special symbols:

    • object – String

    • format – String

    • y – For year representation.

    • m – For month representation.

    • d – For day in the month representation.

  • The number of consecutive special letters indicates the maximum number of digits in the corresponding area.
    For example, mm indicates that the number of the month contains at a maximum, two digits, but it can contain less too. All of this is done to enable the leading zeroes to be omitted. If any of these fields are omitted, the default values of the current date are taken. Other symbols in the format string are not taken into consideration, but the corresponding symbol must be present in the date string too. Otherwise, the date is considered to be in the incorrect format.
    For example, date('14.05.1973', 'dd/mm/yyyy') causes an error because the delimiter in the format does not match the actual one in the date ('.' instead of '/'). If the given data is an incorrect date, the object is marked as containing an invalid date.

Expression

Result

Date('2014/10/16','yyyy/mm/dd'

10/16/2014

Date('2014/10/16','yyyy.mm.dd')

*cannot convert

MC Function: DayOfWeek/DayOfWeekNr/DayOfWeekShrt  

Format

dayOfWeek (dateData)
dayOfWeekNr (dateData)
dayOfWeekShrt (dateData)

Arguments Types

DateData

Date

Return Type

String

Returns Value

  • DayOfWeek: Returns day of week from the specified parameter of type Date.

  • DayOfWeekNr: Returns day of week number from the specified parameter of type Date.

  • DayOfWeekShrt: Returns day of week abbreviation from the specified parameter of type Date.

  • If a parameter has a type other than what is needed, zero is returned.

MC Function: ExecuteMethod   

Format

executeMethod( methodName )

Arguments Types

MethodName

String

Return Type

Any

Returns Value

  • Makes an attempt to execute the method specified by the string methodName. If the attempt is successful, the result of the method execution is returned, having the type and the value defined by the method of execution. If the attempt fails, stated by the message "...there is no such method…," the object of type Undefined is returned.

  • If a parameter has a type other than what is needed, the object of type Undefined is returned.

Examples

Expression

ExecuteMethod('MyMethod')

MC Function: Find   

Format

find( findWhere , findWhat[, startPos = "0", [occurrence= "1"]]);

Arguments Types

findWhere

 String

findWhat

 String

startPos

 Integer

occurrence

 Integer

Return Type

Integer

Returns Value

  • Searches position of the n-the occurrence of the findWhat in findWhere beginning the position startPos, and returns the index. If where is not found, the return index is equal to -1. If start is omitted or is negative, the search is done from the beginning of findWhere. If occurrence is omitted, the first occurrence is returned.

  • If parameter types differ from those needed, an empty string is returned.

Examples

Expression

Result

Find('This is a string', 'string', 0, 1)

10

Find('This is a string', 'is', 0, 2)

5

MC Function: GetDay/GetMonth/GetYear   

Format

getDay(object)
getMonth(object)
getYear(object)

Arguments Types

object

Date

Return Type

Integer

Returns Value

  • Returns the day of the day/month/year for the object respectively.

  • If a parameter has a type other than what is needed, zero is returned.

MC Function: GetDirRoot   

Format

GetDirRoot ()

Return Type

String

Returns Value

  • Returns service root directory.

MC Function: GetLine  

Format

getLine(object[, lineNo = "1"[, pos= "1"]]);

Arguments Types

object

 String

lineNo

 Integer

pos

 Integer

Return Type

String

Returns Value

  • Returns the line, which number is specified in the second parameter lineNo, starting with position indicated by its third parameter pos from the original object of type String, specified by its first parameter object.

  • If lineNo is omitted, or is negative, it is assumed that lineNo is equal to 1.

  • If pos is omitted, or is negative, it is assumed that pos is equal to 0 (start of the string).

  • If parameter types differ from those needed, an empty string is returned.

Examples

Expression

Result

GetLine('abc\ndef\nghi',2,2)

'ef'

MC Function: GetLines   

Format

getLines(object[, startLine[, howMuch]]);

Arguments Types

object

 String

startLine

 Integer

howMuch

 Integer

Return Type

String

Returns Value

Returns SimpleString that contains at much number of lines, specified by third parameter howMuch, starting with line number specified by second parameter startLine (1 based), from the object, specified by its first parameter object.

  • If startLine is omitted, or is negative, it is assumed that startLine is equal to 1.

  • If startLine is bigger than the number of lines, an empty string is returned.

  • If there is no line with indicated line number, lineNo, or if position pos indicates after the end of the string, an empty string is returned.

  • If parameter types differ from those needed, an empty string is returned.

Examples

Expression

Result

GetLines('aaa\nbbb\nccc',2,2)

 'bbb ccc'

MC Function: GetPlatform 

Format

GetPlatform ()

Return Type

String

Returns Value

  • Returns OS type (WIN or UNIX).

Examples

Expression

Result

GetPlatform()

'WIN'

GetPlatform()

'UNIX'

MC Function: GUID   

Format

GUID( )

Returns Value

  • Returns the string type identifier for the indicated expression.

Examples

Expression

Result

GUID()

GFHGJ7FGHJ6FF555

MC Function: GetTypeName   

Format

GetTypeName(expr)

Returns Value

  • Returns the string type identifier for the indicated expression.

Examples

Expression

Result

GetTypeName('1')

String

GetTypeName(123)

Long

MC Function: If   

Format

IF (expression) THEN [statements_if_true;] ELSE [statements_if_false;]

Arguments Types

object

 String

decsep - decimal separator

 String

thoussep  -  thousands separator

 String

Return Type

Double

Returns Value

This function conditionally executes a group of statements, depending on the value of an expression.

Examples

Expression

IF (Atoi(:tag10:)>0) THEN [nop();nop(); ] ELSE [nop(); nop();]

MC Function: Iif   

Format

iif(logexpr, result_if_true, result_if_false)

Arguments Types

logexpr

Any type

result_if_false

Any type

result_if_true

Any type

Return Type

Any type can be returned

Returns Value

  • Any value can be returned.

  • If parameter logical_expression evaluates to true, returns second parameter result_if_true, otherwise third parameter result_if_false is returned. The second and the third parameters should (but not must) be of the same type.

  • The logical expression is true only if it is:

    • Of type Date, and the date is valid,

    • Of type Time, and the time is valid,

    • Of time, String, and the string is non-empty, and

    • Of one of numeric type Integer, Double, or Long, and contains non-zero.

Examples

Expression

iif(Atoi(:tag10:)>0,nop(), nop())

MC Function: IsAlpha   

Format

isAlpha(object_to_test)

Arguments Types

object_to_test

 String

Return Type

Integer

Returns Value

  • Returns true (non-zero) if the specified parameter (object_to_test) is alpha: consists only from letters.

  • If a parameter has a type other than what is needed, zero is returned.

Examples

Expression

Result

IsAlpha('abc')

1

IsAlpha('123')

0

IsAlpha('a2bc')

0

MC Function: IsAlphaNumeric   

Format

isAlphaNumeric(object_to_test [,separator= ","])

Arguments Types

object_to_test

 String

separator

 String

Return Type

Integer

Returns Value

  • Returns true (non-zero) if the first specified parameter (object_to_test) is alpha-numeric: consists only from letters and digits and at maximum one presence of decimal point separator (indicated by second parameter).

  • If a parameter has a type other than what is needed, zero is returned.

Examples

Expression

Result

IsAlphaNumeric('abc')

1

IsAlphaNumeric('123')

1

IsAlphaNumeric('a2bc')

1

MC Function: IsDefined   

Format

isDefined(varName)

Arguments Types

varName

String/Integer/Long

Return Type

Integer

Returns Value

  • Returns true (non-zero) if the variable, indicated by its parameter varname, is defined.

  • If parameters have types other than those needed, 0 (zero) is returned.

MC Function: IsNull 

Format

isNull(object)

Arguments Types

object

Any type

Return Type

Integer

Returns Value

  • Returns true (non-zero) if the specified parameter object has type Null.

Examples

Expression

IsNull(:var:)=1 if :var: has not been initialized anywhere before

IsNull(1)=0 as number 1 is not Null

MC Function: IsNumeric  

Format

isNumeric(object_to_test[, separator= ","])

Arguments Types

object

 String

separator

 String

Return Type

Integer

Returns Value

  • Returns true (non-zero) if the first specified parameter (object_to_test) is numeric: consists only from digits and at maximum one presence of decimal point separator (indicated by second parameter).

  • If a parameter has a type other than what is needed, zero is returned.

Examples

Expression

Result

IsNumeric('123')

1

IsNumeric(345)

1

IsNumeric('a')

0

IsNumeric(a)

error

MC Function: Left  

Format

LEFT(left_object, left_howMuch)

Arguments Types

left_object

 String

left_howMuch

 Integer

Return Type

String

Returns Value

  • Returns left substring of its first parameter (left_object), having at much number of characters, indicated by its second parameter (left_howMuch). Attempts to convert parameters to needed types in contrast to SubString.

Examples

Expression

Result

LEFT('abcde',3)

'abc'

MC Function: Lower   

Format

Lower(object[, startPos = "0"[, howMuch = "-1"]])

Arguments Types

object

 String

startPos

 Integer

howMuch

 Integer

Return Type

String

Returns Value

  • Changes the case of symbol to lowercase in the object, specified by its first parameter object, starting with position indicated by its second parameter startPos, and maximum number of changes, specified by its third parameter howMuch, are made.

  • If startPos is omitted, or is negative, it is assumed to be equal to the start of the string.

  • If howMuch is omitted, or is negative, it is assumed that all symbols must change the case.

  • If parameter types differ from those needed, an empty string is returned.

Examples

Expression

Result

Lower('ABCDE')

'abcde'

Lower('ABCDE',2)

'ABcde'

Lower('ABCDE',2,1)

'ABcDE'

MC Function: MakeNumber   

Format

MakeNumber( expr1, expr2 )

Returns Value

  • This function creates the number from a specified mantissa and exponent.

MC Function: Mid   

Format

Mid( midObject, midStart, midHowMuch )

Return Type

String

Returns Value

  • This function returns the substring of its first parameter, starting at the position specified by the first parameter. The length of the resulting string is indicated by the third parameter.

MC Function: NoOfLines   

Format

NoOfLines( expr )

Return Type

Integer

Returns Value

  • The number of lines (base 1) the expression contains.

  • If parameters have types other than those needed, 0 is returned.

MC Function: Nop  

Format

Nop()

Return Type

Void

Returns Value

  • The value of type Undefined is always returned.

  • This is a non-operation function. It is required under certain circumstances because its execution speed is fast. It is recommended for use over other functions.

  • Typically, this function is used in iif, and only when the action for one of two conditions exists.

Examples

Expression

Result

iif(isDefined(15), nop(), createVariable(15, "Value"))

  •   In this example, Variable 15 is created only when it does not exist.

  • If Variable 15 did not exist, this expression is somewhat slower than createVariable(15, "Value")

  • If Variable 15 did exist, this expression is much faster than createVariable(15, "Value").

MC Function: PadLeft  

Format

PadLeft( padObject, padChar, padMaxLen )

Return Type

String

Returns Value

  • This function pads objects from the left side with a symbol, specified in the second parameter, so that the resulting string has at a minimum, the padMaxLen symbols.

MC Function: PadRight   

Format

PadRight( padObject, padChar, padMaxLen )

Return Type

String

Returns Value

  • This function pads objects from the right side with a symbol, specified in the second parameter, so that the resulting string has at a minimum, the padMaxLen symbols.

MC Function: RemoveMethod   

Format

RemoveMethod( name )

Arguments Types

name

 String

Return Type

Integer

Returns Value

  • Makes an attempt to remove the already compiled method with a name.

  • If the method was found and successfully removed, one (1) is returned. Otherwise, zero (0) is returned.

  • If parameters have types other than those needed, zero (0) is returned.

MC Function: Replace   

Format

Replace( object, what, with[, from[, howMuch]] )

Arguments Types

object

 String

what

 String

with

 String

from

 Integer

howMuch

 Integer

Return Type

String

Returns Value

  • Substitutes howMuch occurrences of the string what, with the string with, starting with position from in object. The result of the substitution is returned.

  • If From is omitted, or is negative, it is assumed that its value is 0, the start of the string.

  • If howMuch is omitted, or is negative, it is assumed to replace all occurrences of what with with.

  • If parameter types differ from those needed, an empty string is returned.

MC Function: RFind  

Format

RFind( findWhere, FindWhat, startPos='-1', occurrence='1' )

Returns Value

  • This function searches the backward position of the n-th occurrence of the second parameter in its first parameter, beginning with the position specified in its third parameter.

MC Function: Right  

Format

Right( rightObject, rightHowMuch )

Returns Value

  • This function returns the right substring of its first parameter, the length of the resulting string indicated by the second parameter. If the length of the original string is less than the second parameter, the original string is returned unchanged

MC Function: SetMethod   

Format

SetMethod( name, code )

Return Type

Integer

Returns Value

  • Makes an attempt to compile expression code, and if the compilation is successful, associates the compiled expression with the method name. If there is already an existing compiled expression with this name, it is overwritten. This is done only in the case where the code is different from the code of the newly compiled expression. This is to avoid having to compile the same compiled expression twice.

  • Upon the successful creation of methods, one (1) is returned. Otherwise, zero (0) is returned.

  • If parameters have types other than those needed, zero (0) is returned.

MC Function: StringLength  

Format

StringLength( expr )

Return Type

Integer

Returns Value

  • The length of the expression expr if it is of type String. Otherwise, it returns 0.

MC Function: SubString   

Format

SubString( object, [start[, howMuch]] )

Arguments Types

object

 String

start

 Integer

howMuch

 Integer

Return Type

String

Returns Value

  • Returns the substring of the string object starting with position start and containing howMuchcharacters.

  • If start is omitted, or is negative, it is assumed that start is equal to 0.

  • If howMuch is omitted, or is negative, howMuch is assumed to be the length of the string.

  • If start is omitted, or is negative, it is assumed that start is equal to 0.

  • If start+howMuch is bigger than the length of the string, all characters are taken from the position start until the end of the string.

  • If parameter types differ from those needed, an empty string is returned.

MC Function: Time   

Format

Time( object, format )

Arguments Types

object

 String

format

 String

Return Type

Time

Returns Value

  • Makes an attempt to convert the string contained in object using the format format, to type Time.

  • Format string can contain the following special symbols:

    • h – for hours representation.

    • m – for minutes representation.

    • s – for seconds representation.

  • The number of consecutive special letters indicates the maximum number of digits in the corresponding area. For example, mm indicates that the number of minutes contains two digits maximum, but can still contain fewer digits. This is done to allow leading zeroes be omitted. If any of the fields are omitted, the default value (current date) is returned.

  • Other symbols in the format string are not taken into consideration, but the corresponding symbol must be present in the date string too. Otherwise, the date is considered to be of incorrect format.
    For example, ('14:05:33', 'hh/mm/ss') returns an error because the delimiter in the format does not match the actual one in the date, using '.' instead of '/'. If the given data is incorrect time, the object is marked as containing invalid time.

MC Function: Today   

Format

Today()

Return Type

Date

Returns Value

  • Returns the current day value of type Date.

MC Function: Trim   

Format

Trim( object )

Arguments Types

object

 String

Return Type

String

Returns Value

  • Removes the leading and trailing blank characters from the specified string object and returns the resulting object.

  • If parameter types differ from those needed, an empty string is returned.

MC Function: Upper   

Format

Upper( object[, startPos[, howMuch]] )

Arguments Types

object

 String

startPos

 Integer

howMuch

 Integer

Return Type

String

Returns Value

  • Changes the case of the symbols in string object starting with position startPos. At a maximum, howMuchcharacters change the case.

  • Removes the leading and trailing blank characters from the specified string object and returns the resulting object.

  • If parameter types differ from those needed, an empty string is returned.

  • No labels