SuiteCRM Manual – Advanced modules – Advanced Workflow Logical Functions 1

Logical Functions

Logical functions are returning true or false in the form of 1 and 0 so checkboxes typed fields can be filled with these functions. They can be also used as the logical condition for the ifThenElse function.

equal

Signature

{equal(parameter1;parameter2)}

Parameters

parameter1: can be any value of any type

parameter2: can be any value of any type

Description

Determines if parameter1 equals with parameter2

Returns

1 if the two parameters are equal or 0 if not

Example call

{equal(1; 2)} returns 0

notEqual

Signature

{notEqual(parameter1; parameter2)}

Parameters

parameter1: can be any value of any type

parameter2: can be any value of any type

Description

Determines if parameter1 not equals with parameter2

Returns

0 if the two parameters are equal or 1 if not

Example call

{notEqual(1; 2)} returns 1

greaterThan

Signature

{greaterThan(parameter1; parameter2)}

Parameters

parameter1: can be any value of any type

parameter2: can be any value of any type

Description

Determines if parameter1 greater than parameter2

Returns

1 if parameter1 greater than parameter2, 0 if not

Example call

{greaterThan(3; 3)} returns 0

greaterThanOrEqual

Signature

{greaterThanOrEqual(parameter1; parameter2)}

Parameters

parameter1: can be any value of any type

parameter2: can be any value of any type

Description

Determines if parameter1 greater than or equal parameter2

Returns

1 if parameter1 greater than or equal parameter2, 0 if not

Example call

{greaterThanOrEqual(3; 3)} returns 1

lessThan

Signature

{lessThan(parameter1; parameter2)}

Parameters

parameter1: can be any value of any type

parameter2: can be any value of any type

Description

Determines if parameter1 less than parameter2

Returns

1 if parameter1 less than parameter2, 0 if not

Example call

{lessThan(3; 3)} returns 0

lessThanOrEqual

Signature

{lessThanOrEqual(parameter1; parameter2)}

Parameters

parameter1: can be any value of any type

parameter2: can be any value of any type

Description

Determines if parameter1 less than or equal parameter2

Returns

1 if parameter1 less than or equal parameter2, 0 if not

Example call

{lessThanOrEqual(3; 3)} returns 1

empty

Signature

{empty(parameter)}

Parameters

parameter: text value

Description

Determines if parameter is empty

Returns

1 if parameter is empty, 0 if not

Example call

{empty(any text)} returns 0

notEmpty

Signature

{notEmpty(parameter)}

Parameters

parameter: text value

Description

Determines if parameter is not empty

Returns

1 if parameter is not empty, 0 if empty

Example call

{notEmpty(any text)} returns 1

not

Signature

{not(parameter)}

Parameters

parameter: logical value

Description

Negates the logical value of the parameter

Returns

1 if parameter is 0, 0 if parameter is 1

Example call

{not(0)} returns 1

and

Signature

{and(parameter1; parameter2)}

Parameters

parameter1: logical value

parameter2: logical value

Description

Applies the AND logical operator to two logical values

Returns

1 if parameter1 and parameter2 is 1, 0 if any parameters are 0

Example call

{and(1; 0)} returns 0

or

Signature

{or(parameter1; parameter2)}

Parameters

parameter1: logical value

parameter2: logical value

Description

Applies the OR logical operator to two logical values

Returns

1 if parameter1 or parameter2 is 1, 0 if both parameters are 0

Example call

{or(1; 0)} returns 1

Text Functions

Text functions are used to manipulate text in various ways. All the functions listed here are fully supports UTF-8 texts, so special characters should not raise any problems.

substring

Signature

{substring(text; start; length)}

Parameters

text: text value

start: decimal value

length [optional parameter]: decimal value

Description

Cuts the substring of a text field from start. If the length optional parameter is not set, then it cuts all characters until the end of the string, otherwise cuts the provided length. Indexing of a text’s characters starting from 0.

Returns

Substring of the given text

Example call

{substring(This is my text; 5)} returns is my text

{substring(This is my text; 5; 5)} returns is my

length

Signature

{length(parameter)}

Parameters

parameter: text value

Description

Count the characters in a text.

Returns

The count of the characters in a text.

Example call

{length(sample text)} returns 11

replace

Signature

{replace(search; replace; subject)}

Parameters

search: text value

replace: text value

subject: text value

Description

Replace all occurrences of search to replace in the text subject.

Returns

subject with replaced values.

Example call

{replace(apple; orange; This is an apple tree)} returns This is an orange tree

position

Signature

{position(subject; search)}

Parameters

subject: text value

search: text value

Description

Find position of first occurrence of search in a subject

Returns

Numeric position of search in subject or -1 if search not present in subject

Example call

{position(Where is my text?; text)} returns 12

lowercase

Signature

{lowercase(parameter)}

Parameters

parameter: text value

Description

Make text lowercase

Returns

The lowercased text.

Example call

{lowercase(ThIs iS a sAmPlE tExT)} returns this is a sample text

uppercase

Signature

{uppercase(parameter)}

Parameters

parameter: text value

Description

Make text uppercase

Returns

The uppercased text.

Example call

{uppercase(ThIs iS a sAmPlE tExT)} returns THIS IS A SAMPLE TEXT

Mathematical functions

Mathematical functions are used to manipulate numbers in various ways. Several mathematical operators are implemented as functions in Calculate Fields.

add

Signature

{add(parameter1; parameter2)}

Parameters

parameter1: number value

parameter2: number value

Description

Adds parameter1 and parameter2

Returns

The sum of parameter1 and parameter2

Example call

{add(3.12; 4.83)} returns 7.95

subtract

Signature

{subtract(parameter1; parameter2)}

Parameters

parameter1: number value

parameter2: number value

Description

Subtracts parameter2 from parameter1

Returns

The distinction of parameter2 and parameter1

Example call

{subtract(8; 3)} returns 5

multiply

Signature

{multiply(parameter1; parameter2)}

Parameters

parameter1: number value

parameter2: number value

Description

Multiplies parameter1 and parameter2

Returns

The product of parameter1 and parameter2

Example call

{multiply(2; 4)} returns 8

divide

Signature

{divide(parameter1; parameter2)}

Parameters

parameter1: number value

parameter2: number value

Description

Divides parameter2 with parameter1

Returns

The division of parameter2 and parameter1

Example call

{divide(8; 2)} returns 4

power

Signature

{power(parameter1; parameter2)}

Parameters

parameter1: number value

parameter2: number value

Description

Raises parameter1 to the power of parameter2

Returns

parameter1 raised to the power of parameter2

Example call

{power(2; 7)} returns 128

squareRoot

Signature

{squareRoot(parameter)}

Parameters

parameter: number value

Description

Calculates the square root of parameter

Returns

The square root of parameter

Example call

{squareRoot(4)} returns 2

absolute

Signature

{absolute(parameter)}

Parameters

parameter: number value

Description

Calculates the absolute value of parameter

Returns

The absolute value of parameter

Example call

{absolute(-4)} returns 4

Leave a Comment