Skip to main content

Expressions

An expression is a combination of values, variables, operators, and functions that can be evaluated to produce a result. Think of it as a sentence of instructions that we tell inorigo®, and to get an answer from these instructions we need to write it in a language that inorigo® understands, i.e., expressions.

Overview


Expressions allow you in this way to customize and transform your data from the information you have to the information that you need. They can help you reduce the need for additional attributes and enable you to, for example, apply logic, use formulas, manipulate dates, or filter items. 

Where can we use expressions?

Expression can be applied in some way for most modules in inorigo®. Look for an “Expression” text box for where you can add an expression. This can for example be in attribute automation in Model Builder or calculated columns in Knowledge Set Builder. 


How to use expressions

Expressions can be as simple as a single value or variable, or they can be more complex, involving multiple values, functions, and operators. Some common types of expressions include Mathematical expressions (such as 2 + 3), logical expressions (such as x > y or a == b), and string expressions (such as "Hello,  " + “name”).

A good use for expressions is to manipulate the data that you have created in Model Builder in other modules such as Application Builder and Knowledge Set Builder, but you can also, to some extent, use them in Model Builder. Note that the trickiest part about learning how to use expressions will be understanding how each available function works.



We have categorized the available functions according to their use in this documentation along with descriptions on how you can apply them in expressions.


Vocabulary

Boolean
A value that is either true or false.

Double
A number with decimals, for example 22.343.

Integer
A positive or negative whole number, including 0.

Expression
A combination of variables, constants, operators, and functions that are put together in a single statement to be evaluated.

Function
Always contains $ + Function name and a start and closing parentheses (). All functions are expressions but not all expressions contain functions.

GID
Global Identifier. A way for inorigo® to identify objects.

Input
The data we give to inorigo® to process.

Null
Means that something is undefined. It has no value but note it is not equal to zero.

Output
The result we get back from inorigo® from the processing.

Operate
An action that is carried out to accomplish a given task

Inward function
A function that is enclosed within another function.
Example: $FORMAT_DATE**($GET({p0},"StartDate")**"DATE_LONG")

Outward function
The surrounding function that encloses another function.
Example$FORMAT_DATE($GET({p0},"StartDate"), "DATE_LONG")

Operator
A character that represents a mathematical or logical action, such as +-= or >.

Parse
Converting information into a format. This so to make something understandable for inorigo®.

Parameter
The variable listed inside the parentheses in the function definition.

Argument
The value that are sent to the function when it is called.
Example: X=3, here the 3 is the argument and X is the parameter.

Variable
Container for storing data values. 

Constant
A fixed value, for example the number 5. The value does not change and is predefined.

String
A sequence of characters, for example “Hello world”.

Substring
A string that is part of another string. "Hel" is for example a substring of "Hello World".

Syntax
The concept/rules of how different elements in an Expression should be combined in order for it to run correctly.

Zero based Index
A way of numbering in which the initial element of a sequence starts at the index 0 rather than the usual index 1.



$ Functions - Summary List

inorigo® has a number of Built-in functions, which are listed below in alphabetical order.

NameDescription
ABSCalculates the absolute value of a double value.
ACOSCalculates the arc cosine of a number.
ADDAYAdd days to a given date.
ADDHOURAdd hours to a given date.
ADDMILLIEAdd milliseconds to a given date.
ADDMINUTEAdd minutes to a given date.
ADDMONTHAdd months to a given date.
ADDSECONDAdd seconds to a given date.
ADDWEEKAdd weeks to a given date.
ADDYEARAdd years to a given date.
AGGREGATEPerforms an aggregation on a collection of items.
ASCIITOSTRINGReturns a String object representing the specified decimal ASCII character.
ASINCalculates the arc sine of a number.
ATANCalculates the arc tangent of a number.
ATINDEXReturns the value at specified (zero-based) index of a list or array.
AVGCalculates the average of the given arguments.
CALLExecutes an Inorigo Method and returns the first output of the method.
CEILCalculates the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.
COALESCEReturn the first non null value.
CONTAINSChecks if one is contained within two.
COSCalculates the cosine of a number.
COSHCalculates the hyperbolic cosine of a number.
COTCalculates the cotangent of a number (1/tan(n)).
CSCCalculates the cosecant of a number (1/sin(n)).
DATE_LONGFormats a timestamp according to Formats a timestamp according to DateTimeLayout.DATE_LONG format.
 format.
DATE*SHORTFormats a timestamp according to DateTimeLayout.DATE_SHORT format.
DATEADDAdds to a given date depending on DatePart.
DATEFORMATFormats a timestamp as a string.
DATEPARTReturns the desired date part of a timestamp.
DATETIME_LONGFormats a timestamp according to DateTimeLayout.DATETIME_LONG format.
DATETIME_SHORTFormats a timestamp according to DateTimeLayout.DATETIME_SHORT format.
DAYCalculate the day of a date, or the current day if no date argument is passed.
DAYNAMECalculate the day name of a date, or the current day name if no date argument is passed.
DEFINITIONSReturns a list of definition IDs for one or several instances.
DISTINCTPerforms a distinct operation on a collection of items.
DISTINCTBYCOLUMNSCreates a Data Set containing column matched unique rows.
ECalculates the double value that is closer than any other to e, the base of the natural logarithms.
EVALUATEThe function can replace method calls and enhance performance substantially, particularly if used in a calculated column in a knowledge Set with many rows.
EXPCalculates Euler's number e raised to the power of a number.
EXPREvaluates an expression
FILTERPerforms a filter operation on a collection of items.
FILTERNULLRemove null values from a collection of items.
FINDMANYReturns all GlobalIDs matching the supplied criterias.
FINDONEReturns one GlobalID matching the supplied criterias.
FINDSTRReturns the index of a substring within a string.
FLOORCalculates the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
FOREACHExecutes an expression for each item in a collection of items.
FORMAT_DATEFormats a timestamp as a string.
FORMAT_NUMBERFormats a number using the current locale.
GETReturns an Attribute Value. Can also be used to get a hash map value.
GIDCreates a GlobalID.
HOURCalculate the hour of a date, or the current hour if no date argument is passed.
HTML_ENCODEMakes a string safe to present on web.
IFNULLReturns second or third argument, depending on wether first argument is null.
IIFReturns second or third argument, depending on boolean first argument.
IS_AUTHORIZEDCheck entity for authorization.
ISNULLReturns wether first argument is null.
KNOWLEDGE_SETExecutes a Knowledge Set.
LEFTReturns the leftmost _n* characters of a string.
LOADDeprecated.
LOGCalculates the natural logarithm (base e) of a number.
LOG10Calculates the base 10 logarithm of a number.
LOOKUPPerforms a lookup by attribute values.
LOOPExecutes an expression for each item in a collection of items.
MAXCalculates the greater double value of two numbers.
MILLISECONDCalculate the millisecond of a date, or the current millisecond if no date argument is passed.
MINCalculates the smaller double value of two numbers.
MINUTECalculate the minute of a date, or the current minute if no date argument is passed.
MONTHCalculate the month of a date, or the current month if no date argument is passed.
MONTHNAMECalculate the month name of a date, or the current month name if no date argument is passed.
NOWCalculates the current date and time.
NTHReturns the n:th object in a list or the n:th letter in a string.
NULLReturns null.
OBJECTReturns an GlobalID using the supplied identification.
PACKReturns a list of the arguments supplied.
PARTNERSReturns a list of partner Global Identifiers.
PERCENTCreates dataset with added percentage column(s).
PICalculates the double value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter.
POWCalculates the double value of the first number raised to the power of the second number.
QUARTERCalculate the quarter of a date, or the current quarter if no date argument is passed.
QUARTERNAMECalculate the quarter name of a date, or the current quarter name if no date argument is passed.
REFERENTSReturns Attribute Value referents for a given instance.
REPLACEREGEXThe function can replace method calls and enhance performance substantially.
REPLACESTRReplace part(s) of a string. It is used to replace parts of a string using a regular expression.
RIGHTReturns the rightmost n characters of a string.
ROUNDRounds the first argument to the number of decimals specified by the second argument, using the HALV_EVEN rounding mode.
SECCalculates the secant of a number (1/cos(n)).
SECONDCalculate the second of a date, or the current second if no date argument is passed.
SELECTSelect rows and columns from a Dataset or a List of Dataset rows.
SERIAL_NOGenerates the next serial number for the given pool.
SINCalculates the sine of a number.
SINHCalculates the hyperbolic sine of a number.
SIZEPerforms a size operation on a value.
SORTPerforms sorting on a collection of items.
SQRTCalculates the square root of a number.
STRING_JOINReturns a string built from a list of items, with specified delimiter and optional prefix and suffix
STRINGFORMATPerforms a string.format() operation.
SUBCLASSESReturns a list of subclasses.
SUBSTRReturns a substring of the first input string.
SUMReturns summary of values.
SUPERCLASSESReturns a list of superclasses.
TANCalculates the tangent of a number.
TANHCalculates the hyperbolic tangent of a number.
TIME_SHORTFormats a timestamp according to DateTimeLayout.TIME_SHORT format.
TIME_SHORT_MILLIESFormats a timestamp according to DateTimeLayout.TIME_SHORT format.
TIMESPANCalculates the timespan between two timestamps or a duration.
TO_COORDINATECreates a valid Coordinate for use in maps.
TOARRAYCreates an array of the supplied input.
TODATEParse argment to timestamp.
TODATETIMEParse argment to timestamp.
TODOUBLEParse argment to double
TOGLOBALIDCreates a GlobalID.
TOINTParse argment to integer
TOLISTCreates a List of the supplied input.
TOLONGParse argment to long
TOLOWERTurns a string into lower case.
TOLOWERCASETurns a string into lower case.
TOSTRINGReturns argument as its string representation.
TOULONGParse argment to unsigned long (BigInteger)
TOUPPERTurns a string into upper case.
TOUPPERCASETurns a string into upper case.
TRANSLATETranslates a text.
TRIMRemoves leading and trailing spaces from a string.
VELOCITY_IFRAMEReturns an IFRAME HTML tag for a Velocity page.
VELOCITY_URLReturns an URL for a Velocity page.
WEEKCalculate the week of a date, or the current week if no date argument is passed.
YEARCalculate the year of a date, or the current year if no date argument is passed.
YEAR_QUARTERCalculate the year and quarter name of a date, or the current year and quarter name if no date argument is passed.



Legacy Expression Editor

The below are relevant for the Model Builder and Application builder

Expression Editor

The Expression Editor will simplify the readability of expressions as it checks for inconsistencies and helps you with some guidance and basic validations to create the expression.

Note, the Visible option is not always available, it depends on the context expression is used, e.g. it is useful when writing expressions for map Info panel.

The Functions context menu options will show all the available Expression Functions

and they are inserted in Expression field as they are selected.

There are a few shortcuts to some of the most common operations/variables/functions used;

Ctrl-G$GET
Ctrl-I@item (the Source object in map configuration)
Ctrl-N“name”
Ctrl-R@record

Variables – Verso View will give the list of available default variables, user defined variables and dataset(s) as input to new Expression Variables in view;

Example that shows the available items defined in view


Refresh this menu

Sometimes the contents of the context menu are not updated, especially for some Variables and Datasets that require calculations to be updated, hence the Refresh option to update the list.



Expression Reference Guide


Advanced Functions


$CALL

Executes an Inorigo Method and returns the first output of the method.

Input:

String methodName , Any param1, Any param2,...

Output:

Any

Usage:

  • $CALL(Target Global Identifier [, method input, ...])
  • $CALL(Method Unique Identifier [, method input, ...])
  • $CALL(Method Fully Qualified Name [, method input, ...])

Example:

$call("MyChange/HelloWorld", "Hey", "You"). This will run the method "HelloWorld" in the process object "MyChange" and give "Hey" and "You" as input variables.

 

$Coalesce

Return the first non null value.

Input:

Object or list/collection

Output:

Any

Usage:

$COALESCE(@NULL, 1, 2, "test") → 1

Example:

We have associations of the definition Person in a filter box. The below expression will output the first non null item in the selected lis

This expression is first checking if the first selected item in p0 is null via $NTH({p0}, 0), if null, it will return "Nothing is selected in p0!" but if any value is found it will return the first non null item.

Result below. Notice how the output changes accordingly to whether if a item in a higher order is selected.

 

$EXPR

Evaluates an expression


Input:

String expression

Output:

Any

Usage:

$EXPR("Hello inner world.").

 

$IS_AUTHORIZED

Check entity for authorization.


Input:

  1. Entity or Entity ID.
  2. Action (Read / Update / Create / Delete / Execute).
  3. Optional User ID. If empty, current user is used.

Output:

  • True or False.

Usage:

$IS_AUTHORIZED(@item, "Read")

$IS_AUTHORIZED(@item, "Read", @USER_ID)

$IS_AUTHORIZED(@item, "Read", "F973B5C0-21B3-D4AB-870D-A42201230315")

Example:

We have a filter box (p0) containing associations of the definition Person which we are showing in a result matrix by using p0.all.

We add the below expression as a calculated column which will check if the current user is able to delete each of the associations in the p0:

 

$KNOWLEDGE_SET

Executes a Knowledge Set. Returns the execution result as a DataSet, suitable for further processing

Usage:

$KNOWLEDGE_SET(@KsID).

$KNOWLEDGE_SET("7f69e05c-5adc-4bce-a88b-0640c84792e5").

Example:

We have a Knowledge Set containing associations from the definition Person with the attribute Columns below:

We want to view this data structure in Application Builder as well. So we add our below expression and input the ID of the Knowledge Set to a Result Matrix in Application Builder:

$KNOWLEDGE_SET(aaa52881-f7af-78e9-1cec-b00400807535)

 


This will result in below view:


$Null

Returns null.

Usage: 

$NULL().

 

 $SERIAL_NO

Generates the next serial number for the given pool.Returns a number of type long


Usage:

$SERIAL_NO("GENERAL_POOL").

$STRINGFORMAT("EMP-%02d", $SERIAL_NO({POOL_NAME}))


Example:

We want to create create an expression that generates serial number for our Serial Pool named Test_Pool. This should then be used in an automation for an attribute called Serial Number within a definition named Person.

We first create the Serial Number Pool in System Management;


We then call the Serial Number Pool we just created in the automation panel within the attribute:

 

When we create a new association for the definition we can see the Serial Number attribute. Note that it will not generate until we save the association.

 

Now we have saved the new association and we can see the generated Serial Number:

 

$TO_COORDINATE

Creates a valid Coordinate for use in maps.

Usage:

$TO_COORDINATE(@MyLatitude, @MyLongitude).

$TO_COORDINATE(@MyStringCoordinate).


$VELOCITY_IFRAME

Returns an IFRAME HTML tag for a Velocity page.

Usage:

$VELOCITY_IFRAME("de305d54-75b4-431b-adb2-eb6b9e546014") $VELOCITY_IFRAME("HelloWorld.html")

$VELOCITY_IFRAME("de305d54-75b4-431b-adb2-eb6b9e546014","RUNTIME_ID=" + @RUNTIME_ID + "&CLICK="+@CLICK)

 

$VELOCITY_URL

Returns an URL for a Velocity page.

Usage:

$VELOCITY_URL("de305d54-75b4-431b-adb2-eb6b9e546014") $VELOCITY_URL("HelloWorld.html")

$VELOCITY_URL("de305d54-75b4-431b-adb2-eb6b9e546014","RUNTIME_ID=" + @RUNTIME_ID + "&CLICK="+@CLICK)

 

Aggregation functions

<br>

What is an Aggregate function?

These functions operates on a set of values and returns a single value as an output.

Note:

Ignores null values.

Performs an aggregation on a collection of items. Optionally grouped.

<br>

$AGGREGATE

Input:

Items - a collection of items supported by $GET() (i.e GlobalID, DataSetRow, HashMap, SelectorItem etc)

Aggregation Type - case insensitive. (Sum, Count, Average, Median, Min, Max, StdDeviation, Variance, Percentage)

Aggregation Column(s).

Optional - Group Column(s).

Output:

Always returns a DataSet.

Aggregation columns will be suffixed with the type of aggregation (e.g "Income (Sum)").

If no Group column(s) has been supplied a default "Total" column will automatically be generated and aggregation result(s) will start at column 1.

Usage:

$AGGREGATE({Dataset}, "Sum", "Amount")

$AGGREGATE({Dataset}, "Sum", "Amount", "Category")

$AGGREGATE({Dataset}, "Average", "Income", "Gender", "Age")

$AGGREGATE({p0}, "Average", $PACK("Income","Tax"), "Gender", "Age")

$AGGREGATE({p0}, "Median", $PACK("Income","Tax"), $PACK("Gender", "Age"))

Example:

In this example we have a filter box (p0) containing associations of the definition Person with an Employment and Age Attribute. We want to see the average age per Employment in a result matrix.

What we can do to achieve this is to use the aggregate function in an expression where we specify our Aggregation type as "AVG" and then add our Aggregation and group column (Age, Employment) :

$AGGREGATE({p0}, "Average", "Age", "Employment")

<br>

 

$AVG

Calculates the average of the given arguments.

Input:

List of numbers

Output:

Double


Usage:

$AVG(List of Numbers)

$AVG(List of Dates)

$AVG(List of Entities, attribute name or id)

$AVG(List of Global Identifiers, attribute name or id)

 

Example:

We have a filter box p0 containing associations of the definition Person with an Age attribute. We want to see the average age of all persons in p0. We therefore use the below expression in a calculation box, which tells Inorigo to calculate the average of the all the age attribute values in p0:

 

$AVG({p0.all}, "Age") 

<br>

$MAX

Calculates the greater double value of two numbers.

 

Input:

Double, Double

Output:

Double

Usage:

$MAX(@myFirsNumber,@mySecondNumber)

$MAX(List of Numbers)

$MAX(List of Dates)

$MAX(List of Entities, attribute name or id)

$MAX(List of Global Identifiers, attribute name or id)

 

Example 1:

We can use $MAX to return the largest number/date in a list. We have associations of the definition Person listed in the filter box p0 that has the attribute StartDate which consist of a date. Let's say we want to see the latest date in for all these persons in p0, we can then use the below expression in calculation box:

 <br>

<br>

Example 2:

We have associations of the definition Person listed in p0 which have an attribute called Scope. What we want to do is to check if the selected persons in p0 together have a scope value larger than 200. If not then return 200, and if yes then return the sum of the selected scope values. In the first image you can see that we have selected Sara Bloom, which have Scope of 90. But since it's not larger than the 200 we specified it will not change in the top calculation box

<br>

$MAX($SUM({p0},"Scope"), 200)

Returns 200 or the selected sum of Scope in p0, whichever being the largest.

 <br>

But now we select more people which brings our total scope values to that of 205. The top calculation box now changes to 205 as the sum is over 200.

 <br>

$MIN

Calculates the smaller double value of two numbers.

Input:

Double, Double

Output:

Double

Usage:

$MIN(@myFirsNumber,@mySecondNumber)

$MIN(List of Numbers)

$MIN(List of Dates)

$MIN(List of Entities, attribute name or id)

$MIN(List of Global Identifiers, attribute name or id)

Example 1

We can use $MIN to return the smallest number/date in a list. Here we have persons associations listed in p0 (Person) which has the attribute StartDate which consist of a date. Let's say we want to see the earliest date in for all these persons in p0, we can then use the below expression in calculation box:

$MIN($GET({p0}, "StartDate"))

<br>

Example 2

$MIN($SUM({p0},"Age"), 50)  

Returns 50 or the sum of p0, whichever being the smallest.

In this example we have a filter box containing associations of the definition Person with the attribute age. We want to see if the sum of the selected ages in the filter box p0 (Person) is below 50, if yes return return the sum of selected ages, if no then return 50.

Here we have only selected one person that have an age of 35, and since it is smaller than 50, the top Calculation box returns the sum of ages selected (35).

 <br>

<br>

But here we have selected more people in the filter box which brings our total sum of the ages combined to 98. And since this age sum is larger than 50 the expression will return 50 in the top result Calculation box.

<br>

$PERCENT

Creates a dataset with added percentage column(s).


Input:

Items. A collection of DataSet rows, like a normal dataset or the result of an Aggregation

Value Column(s).

Optional -  Total Grouping Column(s).

Output:

Always returns a DataSet.

Aggregation columns will be suffixed with % (e.g "Income %").

If no Grouping column(s) has been supplied, the total is simply the sum of all values in the Value column.

Usage:

$PERCENT({Dataset}, "Amount", "Category")

$PERCENT({Dataset}, "Income", "Gender", "Age")

$PERCENT({Dataset}, $PACK("Income","Tax"), "Gender", "Age")

$PERCENT({Dataset}, $PACK("Income","Tax"), $PACK("Gender", "Age"))


Example:

In the below example we have a dataset (DS) containing associations of the definition Person with the attributes Employment, and Income.

<br>

 <br>

Using the below expression in a Result Matrix will output the percentage of the total Income per Employment for each row in the dataset DS. Where our dataset is the items input, Income is the value column and Employment is the total grouping column

<br>

$PERCENT({DS}, "Income", "Employment") 

<br>

$SUM

Returns summary of values.

This function is used for summarizing lists, plus a reference to the object attribute value to be summed.

Input:

Collection of numbers or Collection<GID/DataObject>, String attribute

Output:**

Double

<br>

Usage:

$SUM(List of Numbers)
$SUM(List of Dates)
$SUM(List of Entities, attribute name or id)
$SUM(List of Global Identifiers, attribute name or id)

<br>

Example:

In this example we have a filter box p0 containing associations of the definition Person with the attribute age. We want to see the sum of all the selected age attributes values in a calculation box, so we add the below expression. Here p0 is the collection of items input and "Age" is our string attribute:

 

$SUM({p0}, "Age")

 

© 2025 Inorigo AB. All rights reserved.