Functions

Extended has several functions that can be used to perform a variety of actions. Unlike methods, these do not need to be chained to a datatype instance.

All Functions


LIST

The LIST() function is used to create an empty list, or a list of specified items. Items can be of any datatype supported by Extended.

Syntax

Result

LIST()

Creates an empty list

LIST([<item1>], [<item2>], ...)

Creates a list containing the specified items

items

[Optional] Items to be added to the list.

Examples

myList := LIST(1, 2, 3, 4, 5)
myList                              // [1, 2, 3, 4, 5]

myList := LIST(o.100, o.101, o.102)
myList                              // [Corporate Org, EMEA Org, Asia Org]

num

The num() function is used to convert a value into a number. If the value cannot be converted to a valid number, nothing will be returned.

Syntax

Result

num(<value>)

Converts value to a number

value

The value that should be converted to a number.

Examples

myString := "12345"
myNumber := num(myString)
myNumber                        // 12345

myNumber + 1                    // 12346

output

The output() function is used to get the literal “formula” text for a Function or Expression without evaluating it.

Syntax

Result

output(<function>.function)

The function text of the function

output(<expression>.expression)

The expresison text of the expression

function

The Function object that should have its function text outputted.

expression

The Expression object that should have its expression text outputted.

Examples

myFunction := t.EXAMPLE_AGG_FUNCTION        // Function object with function "AGG('A[100]', *this)"
output(myFunction.function)                 // AGG('A[100]', *this)

myExpression := t.EXAMPLE_EXPRESION         // Expression with expression "SELECT Kpi FROM this.object"
output(myExpression.expression)             // SELECT Kpi FROM this.object

priority [5.3.5.0 +]

The priority() function is used to calculate and return a Priority data type. Risk-related objects in the system have a riskPriority property that represents the evaluation of a Risk (probability x consequence). The return value of this property is Priority which allows it to be plotted on Risk Charts or shown as Priority bullets in Tables. The priority() function also returns a Priority value. So by using the priority() function, it is possible to calculate and return a Priority value for non-risk objects. This value can then be plotted on Risk Charts or shown as Priority bullet.

Syntax

Result

priority(<probability>,<consequence>)

Priority value based on default Risk Settings

priority(<probability>,<consequence>,[<RiskSetting>])

Priority value based on the specified Risk Settings

probability

Integer number representing the probability value of the Priority

consequence

Integer number representing the consequence value of the Priority

RiskSetting

[Optional] Object reference to the Risk Setting that should be used for the evaluation

Examples

/*Priority value that would go in coordinates 5,5 (top-right corner) of a Risk Chart using the default Risk Settings
 * With no changes to default Risk Settings, it would be "RED"
 */
priority(5, 5)

/* Priority value that would go in coordinates 5,6 of a Risk Chart using custom Risk Settings of 6x6
 * This custom Risk Setting uses different colors than default, and the Priority would be "DEEPRED"
 */
priority(5, 6, t.sixBySixRisk)

str

The str() function is used to convert a value into a string. Values can be of any datatype supported by Extended. The string representation of an object is <objectID> <objectName>.

Syntax

Result

str(<value>)

Converts value to a string

value

The value that should be converted to a string.

Examples

myNumber := 9000
myString := str(myNumber)
myString

fragment := "It\'s over "
fragment + myString                 // "It's over 9000"

Numeric Functions

abs

Returns the absolute value of the value.

Syntax

Return Value

abs(<value>)

The absolute value of value

value

The number to take the absolute value of

Examples

abs(-13)                                // 13

myNumber := - 500
abs(-500)                               // 500

cbrt

Returns the cube root of the value.

Syntax

Return Value

cbrt(<value>)

The cube root of value

value

The number to take the cube root of

Examples

cbrt(729)                               // 9
myNumber := 125
cbrt(myNumber)                  // 5

ceil

Returns the value rounded up to the nearest integer.

Syntax

Return Value

ceil(<value>)

The next integer to value

value

The number to take the ceiling of

Examples

ceil(13.3)                              // 14
ceil(0.5)                               // 1

myNumber := 4.7834
ceil(myNumber)                  // 5

floor

Returns the value rounded down to the nearest integer.

Syntax

Return Value

floor(<value>)

The previous integer to value

value

The number to take the floor of

Examples

floor(13.3)                             // 13
floor(0.5)                              // 0

myNumber := 4.7834
floor(myNumber)                 // 4

round

Returns the value rounded to the nearest integer. Values such as 0.5 will be rounded up.

Syntax

Return Value

round(<value>)

The nearest integer to value

value

The number to round

Examples

round(13.3)                             // 13
round(0.5)                              // 1

myNumber := 4.7834
round(myNumber)                 // 5

sqrt

Returns the square root of the value.

Syntax

Return Value

sqrt(<value>)

The square root of value

value

The number to take the square root of

Examples

sqrt(81)                        // 9

myNumber := 225
sqrt(myNumber)          // 15