Lookup

Function

Description

uChoice

Returns the value of a given parameter specified by an index

uFirstDifferent

Returns the first parameter value which is different from the first parameter

uFirstNotNull

Returns the first non null parameter

uElements

Returns the number of elements in a delimited string

uToken

Returns the Nth element from a delimited string




uChoice

Description

Returns the value of a given parameter specified by an index. The index value is zero-based, so an index of zero returns the second parameter

Syntax

string uChoice(index, values, ...)

Parameters

integer index

Index number referencing the return value. Zero based.

string values

List of values

Examples

Example 1

IF construct:

uChoice(0, "A", "B") // returns "A"
uChoice(1, "A", "B") // returns "B"

CASE construct:

uChoice(2, "n.a.", "Jan", "Feb", "Mar") //returns "Feb"

Simulate a lookup function, where you want to replace a color id with a correcponding color name

 uChoice(IN.Color, "n.a.", "Red", "Blue", "Green")



uFirstDifferent

Description

Returns the first parameter value which is different from the first parameter

Syntax

string uFirstDifferent(params, ...)

Parameters

params

A list of expressions or values of any data type

Examples

Example 1

uFirstDifferent("2004-05-01", "2004-05-01", "2005-01-04", "2005-11-24",) //returns "2005-01-04"



uFirstNotNull

Description

Returns the first non null parameter.

Syntax

string uFirstNotNull(params, ...)

Parameters

params

A list of expressions or values of any data type

Examples

Example 1

uFirstNotNull(null, null , "A", "B") // returns "A"



uElements

Description

Returns the number of elements in a delimited string. If the second parameter is omitted, a space (ASCII 32) will be taken as a delimiter.

Syntax

integer uElements(text [, delimiter])

Parameters

string text

A string to investigate

string delimiter (optional)

The delimiter to be used. Default delimiter is a space character.

Examples

Example 1

Count tokens in a delimited string

uElements("James T. Kirk") // returns 3



uToken

Description

Returns the Nth element from a delimited string. The second parameter specifies the token number. The index starts at 1. If the third parameter is omitted, a space (ASCII 32) is taken as the delimiter.

Syntax

string uToken(text, index [, delimiter])

Parameters

string text

A string to investigate

Integer index

Number of token to be returned

string delimiter (optional)

The delimiter to be used. Default delimiter is a space character.

Examples

Example 1

uToken("James T. Kirk", 1) // returns "James"
uToken("James T. Kirk", 2) // returns "T."