Functions
- Last UpdatedJan 28, 2025
- 14 minute read
[] – Array constructor
This function is used to construct an array (i.e. a collection of simple string values):
[expression-1, expression-2, …, expression-n]
|
Arguments |
Description |
|---|---|
|
expression-1, 2, n |
Arbitrary expressions, which resulting values becomes items in the array You can specify as many expression arguments as you need Expressions that resolve to an empty value will be excluded from the resulting array |
Example:
[$variable1, $variable2, $variable3].contains(‘xyz’)
Constructs an array of the values held in variables variabl1, variable2 and variable3, then checks whether on of those variable values equals xyz.
[$variable1, $variable2, $variable3].isNull()
Constructs an array of the values held in variables variabl1, variable2 and variable3, then checks whether any of those variable contains a non-empty value.
When defining variables for the user interface (see Variables), arrays make good candidates for lists of valid values.
Concat - Concatenate values
This function is used to concatenate multiple values into one. Depending on your preferences, there are two ways to express this function:
concat(expression-1, expression-2, …, expression-n)
or
expression-1.concat(expression-2, …, expression-n)
|
Arguments |
Description |
|---|---|
|
expression-1, 2, n |
Arbitrary expressions, which resulting values are passed to the function You can specify as many arguments as you need |
Example:
concat(./@id, ‘ – ‘, ./@name)
Assuming the value of @id is "CL001" and the value of @name is "Centrifugal Pump", the result in the above example will be "CL001 – Centrifugal Pump".
Contains – Check for value
This function can be applied for both string and collection expressions and will return a Boolean result.
Applied on a string expression it will search for a sub-string within the string expression, when applied on a collection expression it will search for an item with specified identifier. Depending on your preferences, there are two ways to express this function:
contains(expression, key [, case-sensitive])
or
expression.contains(key [, case-sensitive])
|
Arguments |
Description |
|---|---|
|
expression |
The expression to be inspected. This can either be an expression resolving to a string value or an expression resolving to a collection |
|
key |
An expression resolving to the string value to search for |
|
case-sensitive |
A Boolean expression dictating whether the search should be case sensitive. Default is false |
Example:
contains(./@description, ‘Procedure’)
Returns true when the description property contains the phrase Procedure.
./Enumerations.contains(‘myList’)
Returns true when the collection of Enumeration Lists contains an item with identifier myList.
IsNull – Check for missing value or empty collection
This function can be applied for both string and collection expressions and will return a Boolean result.
Applied on a string expression it will resolve to true when the expression resolves to an empty value, when applied on a collection expression it will return true when the collection do not exist or do not contain any items. Depending on your preferences, there are two ways to express this function:
isNull(expression)
or
expression.isNull()
|
Arguments |
Description |
|---|---|
|
expression |
The expression to be inspected |
Example:
./Extensions[‘myPrefix’).isNull()
Returns true when the current context node does not contain any extensions from the extension namespace with prefix myPrefix.
./@name.isNull()
Returns true when the name property for current context node is empty.
./MaturityLevels.IsNull()
Returns true when the Class Library do not contain any Maturity Level definitions.
IsNotNull – Check for existing value or populated collection
This function can be applied for both string and collection expressions and will return a Boolean result.
Applied on a string expression it will resolve to true when the expression resolves to a non-empty value, when applied on a collection expression it will return true when the collection contains items. Depending on your preferences, there are two ways to express this function:
isNotNull(expression)
or
expression.isNotNull()
|
Arguments |
Description |
|---|---|
|
expression |
The expression to be inspected |
Example:
./Extensions[‘myPrefix’).IsNotNull()
Returns true when the current context node contains an extension from the extension namespace with prefix myPrefix.
./@name.IsNotNull()
Returns true when the name property for current context node is not empty.
IsNullOrWhiteSpace – Check for missing value or empty array
This function can be applied for both string and array expressions and will return a Boolean result.
Applied on a string expression it will resolve to true when the expression resolves to a value not containing white-space characters only, when applied on an array expression it will return true when the array contains no items or items containinig white-space characters only. Depending on your preferences, there are two ways to express this function:
isNullOrWhiteSpace(expression)
or
expression.isNullOrWhiteSpace()
|
Arguments |
Description |
|---|---|
|
Expression |
The expression to be inspected |
Example:
./Extensions[‘myPrefix’)/@myProperty.isNullOrWhiteSpace()
Returns true when the current context node do not contain the extension property myProperty, or the property contains white-space characters only.
Format – Format string with replacement values
This function is used to format a string with replacement values. Depending on your preferences, there are two ways to express this function:
format(expression-1, expression-2, …, expression-n)
or
expression-1.format(expression-2, …, expression-n)
|
Arguments |
Description |
|---|---|
|
expression-1 |
Arbitrary expressions, which result in a string containing placeholders for values passed to the function A placeholder is expressed as "{n}", where "n" represents the zero-based order of the argument. E.g. if there are 3 arguments passed to the function, there should be three placeholders in expression-1, like "{0}", "{1}" and "{2}" You can specify as many arguments as you need, as long as they all match a placeholder You can specify the same placeholder multiple times, to get the same value multiple times in the result |
|
expression-2, n |
Arbitrary expressions which resulting values are to be inserted for the placeholders in expression-1 |
Example:
‘Class {0} – {1} ({2})’.format(./@id, ./@name, ./@permissibleAttributesInSheetCount)
Assuming the value of @id is "CL001", the value of @name is "Centrifugal Pump", and the value of @permissibleAttributesInSheetCount is 39, the result in the above example will be "Class CL001 – Centrifugal Pump (39)".
FormatInt – Format an integer value
This function is used to format an integer value with a minimum number of digits, group separators, etc. Depending on your preferences, there are two ways to express this function:
formatInt(value-expression, format-expression)
or
value-expression.formatInt(format-expression)
|
Arguments |
Description |
|---|---|
|
value-expression |
An arbitrary expression resolving to an integer value. If the expression does not resolve to an integer value no formatting will be applied |
|
format-expression |
An arbitrary expression resolving to a valid format string as described by |
Example:
./@permissibleAttributesInSheetCount.formatInt(‘000’)
Assuming the current context is a class, the result will be the number of permissible attributes for the class, expressed with minimum 3 digits (leading zero).
IsDerived – Check whether a node is derived
This function returns a Boolean indicator on whether specified node is derived. Depending on your preferences, you can express this function in one of two ways:
IsDerived([node-expression])
or
node-expression.IsDerived()
|
Arguments |
Description |
|---|---|
|
node-expression |
An expression resolving to a node. If omitted, the current context node will be used If specified node has been derived (i.e. a permissible attribute has been derived from a parent class, or the @presence property of a permissible attribute has been derived from the corresponding attribute class definition), true will be returned, else false |
Examples:
IsDerived()
If the context node has been derived, true is returned, else false.
./@presence.IsDerived()
Assuming current context is a permissible attribute, if the @presence property has been derived from the corresponding attribute class, true will be returned, else false.
./Extensions[xyz]/@myProperty.IsDerived()
If the extension property myProperty from extension namespace xyz for the context node has been derived from an ancestor, true will be returned, else false.
Max – Pick the maximum of two values, or the maximum array item
This function returns the maximum of two values, or the maximum value of an array. Depending on your preferences, you can express this function in one of two ways:
Max(expression-1[, expression-2])
or
expression-1.Max([expression-2])
|
Arguments |
Description |
|---|---|
|
expression-1 |
Expression resolving to a simple value or an array |
|
expression-2 |
An optional expression resolving to a simple value |
When expression-1 resolves to an array and expression-2 is omitted:
-
When all array items represent integer values, a numerical compare will be applied else the comparison will be according to ordinal sort order, case insensitive
When expression-1 resolves to a simple value and expression-2 is present:
-
If any of the expressions represent non-integer string, the comparison will be according to ordinal sort order, case insensitive
-
If both expressions represent an integer value, a numerical compare will be applied
-
If expression-2 resolves to an empty value, the function will resolve to an empty value
For other conditions, the function will resolve to an empty value
Examples:
max(./@sortOrder, $maturityLevel)
Comparing the Sort Order value of the context node with the value of variable maturityLevel, and returns the maximum value
[$variable1, $variable, 100].max()
Returns the maximum of $variable1, $variable2 and the literal number 100. If $variable1 and $variable2 contains integer values, numeric comparison will be applied, else comparison will be according to ordinal sort order, case insensitive
Max – Pick the maximum property value from a collection
This function compares properties of items in a collection and return the maximum value:
collection-expression.Max([property-expression])
|
Arguments |
Description |
|---|---|
|
collection-expression |
Expression resolving to a collection |
|
property-expression |
An optional expression resolving to a property of the collection items When the property value resolves to an integer, numeric comparison will be applied, else comparison will be according to ordinal sort order, case insensitive |
Examples:
./MaturityLevels.where(./@obsolete !== true && ./@presence == Required).max(./@sortOrder)
Filtering out all Maturity Levels in the Class Library that is not obsoleted, having Presence=Required, and find the maximum Sort Order value.
./Extensions[myPrefix].Nodes.max(./@value)
Finds the maximum value of property value for extension nodes in extension namespace myPrefix.
Min – Pick the minimum of two values, or the minimum array item
This function returns the minimum of two values, or the minimum value of an array. Depending on your preferences, you can express this function in one of two ways:
Min(expression-1[, expression-2])
or
expression-1.Min([expression-2])
|
Arguments |
Description |
|---|---|
|
expression-1 |
Expression resolving to a simple value or an array |
|
expression-2 |
An optional expression resolving to a simple value |
When expression-1 resolves to an array and expression-2 is omitted:
-
When all array items represent integer values, a numerical compare will be applied else the comparison will be according to ordinal sort order, case insensitive
When expression-1 resolves to a simple value and expression-2 is present:
-
If any of the expressions represent non-integer string, the comparison will be according to ordinal sort order, case insensitive
-
If both expressions represent an integer value, a numerical compare will be applied
-
If expression-2 resolves to an empty value, the function will resolve to an empty value
For other conditions, the function will resolve to an empty value
Examples:
min(./@sortOrder, $maturityLevel)
Comparing the Sort Order value of the context node with the value of variable maturityLevel, and returns the minimum value
[$variable1, $variable, 100].min()
Returns the minimum of $variable1, $variable2 and the literal number 100. If $variable1 and $variable2 contains integer values, numeric comparison will be applied, else comparison will be according to ordinal sort order, case insensitive
Min – Pick the minimum property value from a collection
This function compares properties of items in a collection and return the minimum value:
collection-expression.Min([property-expression])
|
Arguments |
Description |
|---|---|
|
collection-expression |
Expression resolving to a collection |
|
property-expression |
An optional expression resolving to a property of the collection items When the property value resolves to an integer, numeric comparison will be applied, else comparison will be according to ordinal sort order, case insensitive |
Examples:
|
./MaturityLevels.where(./@obsolete !== true && ./@presence == Required).min(./@sortOrder) |
Filtering out all Maturity Levels in the Class Library that is not obsoleted, having Presence=Required, and find the minimum Sort Order value.
./Extensions[myPrefix].Nodes.min(./@value)
Finds the minimum value of property value for extension nodes in extension namespace myPrefix.
NodeState – Check the modification state of a node
This function returns the state of the specified node, in terms of whether it has been mutated in the current change session for the Class Library. Depending on your preferences, you can express this function in one of two ways:
NodeState([node-expression])
or
node-expression.NodeState()
|
Arguments |
Description |
|---|---|
|
node-expression |
An expression resolving to a node. If omitted, the current context node will be used Possible values returned from the function is (several values might be combined, separated by a single space character):
|
Examples:
NodeState()
The state of the context node will be returned.
./@name.NodeState()
The state of the @name property of the context node will be returned.
./Extensions[xyz]/@myProperty.NodeState()
The state of the extension property myProperty from extension namespace xyz for the context node will be returned.
OriginalValue – Get the original value of a modified property
When the value of a property has been mutated in the current change session for the Class Library, this function returns the original value of the property. Depending on your preferences, you can express this function in one of two ways:
OriginalValue(property-expression)
or
property-expression.OriginalValue()
|
Arguments |
Description |
|---|---|
|
property-expression |
An expression resolving to a property node |
Examples:
OriginalValue(./@presence)
If the Class Library has been checked out for modification, and the @presence property of the current context node has been modified, this expression returns the original value of the @presence property. If the Class Library is not checked out for modification, or the @presence property of the current context has not been modified, an empty value is returned.
./Extensions[xyz]/@myProperty.OriginalValue()
If the Class Library has been checked out for modification, and the extension property myProperty from extension namespace xyz for the current context node has been modified, this expression returns the original value of the extension property. If the Class Library is not checked out for modification, or the extension property has not been modified, an empty value is returned.
RGB – Colour values
The RGB colour model is an additive colour model in which red, green, and blue light are added together in various ways to reproduce a broad array of colours. The name of the model comes from the initials of the three additive primary colours, red, green, and blue.
This function is used to compose colours by specifying the amount of red, green and blue respectively, in the resulting colour. The function is expressed as:
rgb(red-expression, green-expression, blue-expression)
|
Arguments |
Description |
|---|---|
|
red-expression |
An arbitrary expression, which should result in an integer value between 0 and 255, inclusive, representing the amount of red in the resulting colour The value 0 means no amount of red The value 255 means maximum amount of red |
|
green-expression |
An arbitrary expression, which should result in an integer value between 0 and 255, inclusive, representing the amount of green in the resulting colour The value 0 means no amount of green The value 255 means maximum amount of green |
|
blue-expression |
An arbitrary expression, which should result in an integer value between 0 and 255, inclusive, representing the amount of blue in the resulting colour The value 0 means no amount of blue The value 255 means maximum amount of blue |
|
adjust-expression |
A positive (lighten) or negative (darken) percentage value specifying how the colour should be adjusted |
Example of colour expressions:
rgb(255, 0, 0)
rgb(0, 255, 0)
rgb(0, 0, 255)
rgb(127, 127, 127)
rgb(127, 127, 127, 50)
While the expression:
rgb($red ?? 64, $green ?? 120, $blue ?? 240)
Will result in a colour constructed from the values of the three variables red, green, and blue, alternatively using the default values where the variables are not defined or contain empty values.
RgbAdjust – Lighten or darken a colour value
This function is used to lighten or darken a colour value by a percentage. Depending on your preferences, you can express this function in one of two ways:
rgbAdjust(rgb-colour-expression, +-percent)
or
rgb-colour-expression .rgbAdjust(+-percent)
|
Arguments |
Description |
|---|---|
|
rgb-colour-expression |
An expression that results in an RGB colour value |
|
percent |
A positive (lighten) or negative (darken) percentage value specifying how the colour should be adjusted |
Example of colour adjust expressions:
rgb(255, 0, 0).rgbAdjust(-50)
rgbAdjust(rgb(127, 127, 127), 30)
rgbAdjust($themeColour, 30)
While the expression:
rgbAdjust($themeColour, 30)
Assuming the variable themeColour has been assigned an RGB colour value, the outcome of the function will be a colour value that is 30% lighter than the themeColour.
Substring and Substring0 – Extract parts of a value
This function is used to extract a part of a string value. Depending on your preferences, you can express this function in one of two ways:
substring(string-expression, start-index-expression[, number-of-characters-expression])
or
string-expression.substring(start-index-expression[, number-of-characters-expression])
|
Arguments |
Description |
|---|---|
|
string-expression |
An arbitrary expression, which resulting value is passed to the function |
|
start-index-expression |
An arbitrary expression, which should result in a positive integer value in the range 1-n This value dictates which character in string-expression should be the first one to extract, where 1 is the first character |
|
number-of-characters-expression |
An arbitrary expression, which should result in a positive integer value in the range 0-n This value dictates how many characters to extract from string-expression This argument is optional, and when absent all characters from start-index-expression to the end of string-expression will be extracted |
Substring0 works like Substring, except start-index-expression should be 0 to indicate the first character.
Examples:
./@id.substring(3)
Assuming the value of @id is "CL001", the value of the above example will be "001".
./@id.substring(1,2)
Assuming the value of @id is "CL001", the value of the above example will be "CL".
ToInt – Pick the first expression resolving to an integer value
This function picks the first expression that resolves to an integer value. Depending on your preferences, you can express these functions in one of two ways:
toInt(expression-1[, expression-2, …, expression-n])
or
expression-1.toInt([expression-2, …, expression-n])
Examples:
./@id.toInt(./@sortOrder, 0)
Assuming the value of @id is not an integer value, the value of @sortOrder is returned if populated, else 0 is returned
ToLowerCase and ToUpperCase – Alter letter casing
These functions are used to alter the letter casing in a string expression to all lower-case or all upper-case letters. Depending on your preferences, you can express these functions in one of two ways:
toLowerCase(string-expression)
toUpperCase(string-expression)
or
string-expression.toLowerCase()
string-expression.toUpperCase()
Examples:
./@name.toLowerCase()
Assuming the value of @name is "MOTOR", the value of the above example will be "motor".
./@name.substring(1,1).concat(./@name.substring(2).toLowerCase())
Assuming the value of @name is "ELECTRIC MOTOR", the value of the above example will be "Electric motor".
ToNamingConvention – Get a Naming Convention mapped value
This function provides access to naming convention mapped values for the @id and optionally @name property of Class Library entities. Depending on your preferences, you can express this function in one of two ways:
toNamingConvention(property-expresion, namingConvention-expression[, fallback-expression])
or
property-expression. toNamingConvention (namingConvention-expression[, fallback -expression])
|
Arguments |
Description |
|---|---|
|
property-expression |
A property expression for one of the two potentially naming convention mapped properties ./@id or ./@name |
|
namingConvention-expression |
An expression resolving to the identifier of the target Naming Convention |
|
fallback-expression |
A Boolean expression dictating whether to fallback on the native property value when a naming convention mapping is missing true: when the requested naming convention map is missing, the function resolves to the native Class Library value for the target property false (Default): when then requested naming convention map is missing, the function resolves to an empty value |
Examples:
./@id.toNamingConvention (‘CFIHOS’)
Assuming the target entity has a mapping for naming convention CFIHOS, the function will resolve to the CFIHOS specific identifier.
ToTitleCase – Alter letter casing
This function is used to alter the letter casing in a string expression to all lower case, except for the first letter in each word, which will be in upper case. Depending on your preferences, you can express this function in one of two ways:
toTitleCase(string-expression[, word-delimiter-expression])
or
string-expression.toTitleCase([word-delimiter-expression])
|
Arguments |
Description |
|
string-expression |
An arbitrary expression, which resulting value is passed to the function |
|
word-delimiter-expression |
An arbitrary expression, where the first character of the result is used as the character delimiting the words of string-expression When absent, ‘ ‘ (space) will be used as the character delimiting the words of string-expression |
Examples:
./@name.toTitleCase()
Assuming the value of @name is "ELECTRIC MOTOR", the value of the above example will be "Electric Motor".
./@name.toTitleCase(‘-‘)
Assuming the value of @name is "ELECTRIC-MOTOR", the value of the above example will be "Electric-Motor".
Truncate – truncate a string
This function is used to truncate a string at a maximum number of characters, optionally suffixing with ellipsis. Depending on your preferences, you can express this function in one of two ways:
truncate(string-expression, max-length-expression[, include-ellipsis-expression])
or
string-expression.truncate( max-length-expression[, include-ellipsis-expression )
|
Arguments |
Description |
|---|---|
|
string-expression |
An arbitrary expression, which resulting value is passed to the function |
|
max-length-expression |
An expression resolving to a positive integer value, specifying the maximum number of characters in the result |
|
include-ellipsis-expression |
An expression resolving to a Boolean value, specifying whether to suffix the truncated value with ellipsis (three dots) When the number of characters in the original value is less or equal to specified maximum length, no ellipsis will be included When the original value is truncated, maximum length is including the three dots in the ellipsis Default value is true |
Examples:
./@name.truncate(10)
Assuming the value of @name is "ELECTRIC MOTOR", the value of the above example will be "ELECTRI…".
./@name.truncate(10, false)
Assuming the value of @name is "ELECTRIC MOTOR", the value of the above example will be "ELECTRIC M".
Where – filter collections
This function is used to filter the items of a collection based on a condition:
collection-expression.where(item-condition-expression )
|
Arguments |
Description |
|---|---|
|
collection-expression |
An expression resolving to a collection |
|
Item-condition-expression |
A Boolean expression that will be applied for each item in the collection to select those that qualify |
Examples:
<Variable geicl:id="selectCode" validValues="./Enumerations[myList]/Items.where(!./@obsolete)" …
Defines a variable (presumabely for the user to make a selection in the export dialogue) where the valid values constraint will contain all items from enumerations list myList that has not been obsoleted.