QPR ProcessAnalyzer Expressions: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
Line 745: Line 745:
|}
|}


== Properties and Functions by Object Types ==
== Type Specific Properties and Functions ==


This chapter lists all the object types in the expresssion language and properties and functions that they support. After the property or function name there is the type of the returned object mentioned. Asterisk (*) after the type means that it returns an array of objects.
This chapter lists all the object types in the expresssion language and properties and functions that they support. After the property or function name there is the type of the returned object mentioned. Asterisk (*) after the type means that it returns an array of objects.

Revision as of 09:54, 14 December 2017

Expression and Evaluation Context

An expression is a text to be evaluated that has a result. Result can be any of the supported object types or empty. An expression may consist of multiple expressions, called sub-expressions.

Expression evaluation is always performed within some context. This context and its type defines which kind of functionalities are available. Current context is implicitly accessible in all the expressions. Whenever a function or property is called, functions and properties accessible in the current context are searched first. If function or property is not found in the current context, then more generic context is tried. Error is returned only if the requested functionality is not available in the current context or a generic context. Current context can be accessed explicitly by using variable named _ (underscore).

Expression Chaining and Hierarchies using . and :

Expressions can be chained together two ways:

  • Contextless chaining: When . character is used to chain expressions, the resulting objects will not have context information.
  • Hierarchical chaining: When : character is used to chain expressions, only the result of the whole chained expression will consist of hierarchical arrays (#29290#) where all the values in the first expression (=context object) will be bound to the arrays those values generated. If the second expression does not return an array, the result will be changed to be an array.

The second expression chained to the first one will be evaluated using the following rules:

  • If the result of the first expression is not an array, the second expression will be evaluated with the result of the first expression as its context object.
  • If the result of the first expression is an array, for every element in the array, the second expression will be evaluated with the array item as its context object. The result of the evaluation will be an array of evaluation results (one for each element in the array).
  • If any of the second expression evaluations returns an array, the resulting object will be an array of arrays. If the first expression evaluation returns a typed array, the result will be hierarchic in a way that first level results are objects that contain the information about the actual object as well as the results generated by the second level expressions.

These rules apply also when chaining more than two expressions together. For example, it is possible to generate three level hierarchy with nodes of type: event log -> case -> event: EventLogById(1).Cases.Events or EventLogById(1):Cases:Events.

Examples:

Contextless chaining: First expression not an array, second expression not an array:
"1".("Number is " + _)
Returns:
"Number is 1"

Contextless chaining: First expression is an array, second expression not an array:
[1,2,3].("Number is " + _)
Returns:
["Number is 1", "Number is 2", "Number is 3"]

Contextless chaining: First expression is an array, second expression is an array:
[1,2,3].["Number is " + _, "" + _ + ". number"]
Returns:
[ ["Number is 1", "1. number"], ["Number is 2", "2. number"], ["Number is 3", "3. number"] ]

Hierarchical chaining: First expression is an array, second expression is an array:
[1,2,3]:["Number is " + _, "" + _ + ". number"]
Returns:
[ HierarchicalArray(1, ["Number is 1", "1. number"]), HierarchicalArray(2, ["Number is 2", "2. number"]), HierarchicalArray(3, ["Number is 3", "3. number"]) ]

  • Hierarchical arrays: Whenever traversing a relation in expression language using hierarchical chaining operator ':' for chaining expressions, a hierarchical array will be returned. It is an object which behaves just like a normal array except it stores also context/root/key/label object which usually represents the object from which the array originated from, for example the original case object when querying events of a case.
  • Hierarchical objects: Arrays where at least one object in the array is itself an array is considered to be a hierarchical object. Hierarchical arrays are treated in similar way as normal arrays in hierarchical objects.
  • Depth of a hierarchical object is the number of inner arrays that there are in the object, i.e. how deep is the hierarchy.
  • Level in hierarchical object consists of all the nodes that are at specific depth in object's array hierarchy. 0 is the level at the root of the object, consisting only of the object itself as single item. Levels increase when moving towards leaves.
  • Leaf level is a level that doesn't have any sub levels.

Evaluation Scopes

Scope defines the region of a expression where a specific variable or function name-value binding is valid. In expressions, a variable or function is valid in the following scopes:

  • Scope the variable or function was created.
  • All the child scopes created from the scope in which the variable or function was created.

A new scope is created based on the previous one in the following cases:

  • When starting to evaluate a expression.
  • When recursing the chain of expressions and the type of the current calculation context object is not the same as the previously used one.
  • When evaluating user defined function and its parameters.
  • When evaluating KPI analysis dimensions.
  • When evaluating KPI analysis column names in dynamic values.

User Defined Variables

Variables are properties originating from the current variable scope. Variables can be defined by user into the current scope using Let function. Variables defined in parent scope are available also in all the child scopes. Variables can't be used to override properties. Properties are always checked first before checking scope for variables. For example, you can't override Models property by specifying Models variable.

Generic Properties and Functions

Generic Properties

Generic Properties and Functions are available for all objects.

Property Description
_

Refers to the current context.

_empty

Returns an object which represent a non-existent value. Textual representation of this value is "EMPTY".

_remove

Returns an object which represent a value that should automatically be recursively pruned out of the resulting hierarchy object when processing chained expressions. If all the child values of one context object used in chaining expressions return this object, the root object itself will also be pruned out of the resulting hierarchy object.

Examples:

Both:
[1,2]._remove
[1,2].Where(_==3, _remove)
Return EMPTY

whereas

[1,2].Where(_==3, _empty)
[1,2].Where(_==3)
[1,2]._empty
Returns an empty collection (collection of length 0).

For("i", 0, i < 10, i + 1, i).Where(_ % 2 == 0)
For("i", 0, i < 10, i + 1, i).If(_ % 2 == 0, _, _remove)
Both return:
[0, 2, 4, 6, 8]
CalcId (string)

Returns an id that is unique between all QPR ProcessAnalyzer objects. CalcId is remains the same at least for the duration of the expression calculation. It is possible that CalcId for an object is different in the next calculation. CalcId is EMPTY for other than QPR ProcessAnalyzer objects.

Models (Model*) All Models in the QPR ProcessAnalyzer server (that the user have rights).
Now (DateTime) Timestamp representing the current date and time.
Null

Returns a special null value. Null value is similar to EMPTY value, except null values can also be recursed. In some cases null values can be converted into numbers in which case they act as 0.

Projects (Project*) All Projects in the QPR ProcessAnalyzer server (that the user have rights).

Aggregation Functions

Aggregation functions are performed by default to the leaf level (the deepest level). Aggregation means that leaf level arrays are replaced by the aggregated values, and thus the depth of the hierarchy decreases by one. There are following aggregation functions available: Average, Count, Min, Max and Sum.

Examples:

Count([[1, 2], [3, 4, 5]])
Returns: [2, 3]

Sum([[1, 2], [3, 4, 5]])
Returns: [3, 12]

In addition to the aggregation functions, functions that modify the contents of leaf arrays (OrderBy, Distinct, ...), the operation will be performed separately for every leaf array.

OrderByValue([[4, 3], [2, 1]])
Returns: [[3, 4], [1, 2]]

Mathematical functions

Function Parameters Description
Ceiling (Integer)
  1. Number (Float)

Returns the smallest integer greater than or equal to the specified number.

Floor (Integer)
  1. Number (Float)

Returns the largest integer less than or equal to the specified number.

Round (Float)
  1. Number to be rounded (Float)
  2. Number of decimals (Integer)

Rounds a value to the nearest integer or to the specified number of fractional digits.

Ordering functions

Function Parameters Description
OrderBy (array)
  1. Array to order
  2. Order expression

Orders the given array using values from the given order expression. The order expression is evaluated once for each item in the array. The order expression supports all atomic (=not collection) primitive value types.

Examples:

OrderBy(["a", "x", "b", "z", "n", "l", "a"], _)
Return:
["a", "a", "b", "l", "n", "x", "z"]

OrderBy([9,8,7,6,5,4,3,2,1], _%3)
Returns:
[9,6,3,7,4,1,8,5,2]

OrderBy([9,8,7,6,5,4,3,2,1], _%3 + _/30)
Returns:
[3,6,9,1,4,7,2,5,8]
OrderByDescending (array)
  1. Array to order
  2. Order expression
Result is same as in the OrderBy function, except the order is reverse.
OrderByValue (array)
  1. Array to order

Orders the given array using the natural order of items, for example numbers it's the increasing order, and for strings it's text ordering.

OrderByValue(["a", "x", "b", "z", "n", "l", "a"])
Return:
["a", "a", "b", "l", "n", "x", "z"]

OrderByValueDescending (array)
  1. Array to order

Result is same as in the OrderByValue function, except the order is reverse.

Recursion functions

Function Parameters Description
Recurse
  1. Expression to call recursively
  2. Stop condition expression
  3. Maximum depth (Integer)

Evaluates the given expression recursively until given condition or recursion depth is met. The function returns all the traversed objects in a single array. When the stop condition expression evaluates to false, it will stop the current recursion without including the false evaluated object into the result. Default stop condition is !IsNull(_). The default maximum depth is 1000.

Examples:

(1).Recurse(_ + 1, _ < 5)
Returns: [1, 2, 3, 4]

event.Recurse(NextInCase)
Returns: An array of all the events following given event inside the same case.

event.Recurse(NextInCase, Type.Name != "Invoice")
Returns: An array of all the events following given event inside the same case until event whose type name is "Invoice", which will itself not be included into the result.

event.Recurse(NextInCase, Type.Name != "Invoice", 2)
Returns: An array of all the events following given event inside the same case until event whose type name is "Invoice" or until the recursion depth of 2 has been reached, which will itself not be included into the result.
RecurseWithHierarchy
  1. Expression to call recursively
  2. Stop condition expression
  3. Maximum depth (Integer)

Evaluates the given expression recursively until given condition or recursion depth is met. The function returns the traversed object hierarchy. When the stop condition expression evaluates to false, it will stop the current recursion without including the false evaluated object into the result. Default stop condition is !IsNull(_). The default maximum depth is 1000.

Examples:

[1,2].RecurseWithHierarchy([1,2], false, 2)
Returns: [1:[1:[1,2],2:[1,2]],2:[1:[1,2], 2:[1,2]]]

(1).RecurseWithHierarchy(_ + 1, _ < 5)
Returns: 1:[2:[3:[4]]]

RemoveLeaves(eventLog.Flows:From.Where(IsNull(_))).To.RecurseWithHierarchy(OutgoingFlows.To, !IsNull(_), 2)
Returns: A hierarchy consisting of all the starter events of given event log and recursively all the event types reachable from them via flows until depth of 2 is reached.
RecursiveFind
  1. Expression to call recursively
  2. Find condition expression
  3. Stop condition expression
  4. Maximum depth (Integer)
  5. Continue after finding (Boolean)

Evaluates given expression recursively until given condition or recursion depth is met. The function collects all the traversed objects that match the given find expression along the way. When the find condition expression evaluates to true for the current object, it causes the following:

  • Current object is added to the result array returned by the function call
  • If continue after finding is false, the recursion will not be continued on this branch

When the stop condition expression evaluates to false, it will stop the current recursion without including the false evaluated object into the result. Default stop condition is !IsNull(_). The default maximum depth is 1000.

Continue after finding tells should the recursion be continued after a match has been found in the current branch.

Examples:

(1).RecursiveFind(_ + 1, _ == 100)
Returns: 100

eventLog.Cases:GetAt(0, Events).RecursiveFind(NextInCase, Organization=="Finance", !IsNull(_))
Returns: For each case, returns the first (by time) event whose organization equals to "Finance".

eventLog.Cases:Events.Where(Organization=="Finance")
eventLog.Cases:GetAt(0, Events).RecursiveFind(NextInCase, Organization=="Finance", true, true)
Returns: Both return for each case all events whose organization equals to "Finance".

Other functions

Function Parameters Description
Array
  1. Item 1 (Object)
  2. Item 2 (Object)
  3. ...

Creates a new array where the provided parameters are items of the array. There can be any number of parameters. Note: arrays can also be created using [] syntax.

Examples:

Array(1, 2, 3)
Returns: An array having three elements which are 1, 2 and 3.
Also following syntax can be used: [1, 2, 3]

Array()
Returns: An empty array.
DateTime
  1. Year (Integer)
  2. Month (1-12) (Integer)
  3. Day (>= 1) (Integer)
  4. Hour (>= 0) (Integer)
  5. Minute (>= 0) (Integer)
  6. Second (>= 0) (Integer)
  7. Millisecond (>= 0) (Integer)

Creates a new date time. Only the first (year) parameter is mandatory.

Examples:

DateTime(2017)
Returns: A date time object for 1st January 2017 at 0:00:00.

DateTime(2017, 5)
Returns: A date time object for 5th January 2017 at 0:00:00.

DateTime(2017, 5, 6, 13, 34, 56, 123)
Returns: A date time object for 6th May 2017 at 13:34:56.123.
TimeSpan
  1. Days (Integer)
  2. Hours (Integer)
  3. Minutes (Integer)
  4. Seconds (Integer)
  5. Milliseconds (Integer)

Create a new time span object. Only the first (days) parameter is mandatory. Others are assumed to be zero.

Examples:

TimeSpan(1)
Returns: Time span for the duration of 1 day.

TimeSpan(12,3,4,5,6)
Returns: Time span for the duration of 12 days, 3 hours, 4 minutes, 5 seconds and 6 milliseconds.
Catch
  1. Expression to evaluate (Expression)
  2. Result if exception (Object)

Calculate given expression and if any exceptions are thrown during the evaluation of the expression, catch that exception and return given value. Note that this function does not catch any syntactical errors.

Examples:

Catch(1, 1234)
Returns: 1

Catch(undefined, 1234)
Returns: 1234

Catch([1,2].undefined, 1234)
Returns: 1234

Catch(EventLogById(-1), 1234)
Returns: 1234
Coalesce
  1. Object to coalesce
  2. Result if Null

Returns the second parameter if the first parameter evaluates to null or empty. If given a hierarchical object, applies the function at the leaf level. If the the given object is a hierarchical object, all its leaf level values are coalesced separately.

Examples:

Coalesce(0, 1)
Returns: 0

Coalesce(null, 1)
Coalesce(_empty, 1)
Coalesce(_remove, 1)
All return: 1

Coalesce([[null, 1], [null, null]], 3)
Returns: [[3, 1], [3, 3]]

Coalesce([[null, 1], 2], 3)
Returns: [[3, 1], null]

Coalesce([1, [null, 2], null], 3)
Returns: [1, [null, 2], 3]
Def
  1. Function name (String)
  2. Variable name 1 (String)
  3. Variable name 2 (String)
  4. ...
  5. Function expression

Creates a new user defined function. The created function is valid only within the current scope and all its child scopes. Parameters starting from the second are the names of the parameters that the user gives when calling the user defined function. The order of the names is the same as the order used when giving the parameters. The last parameter is the expression to evaluate when the function is called.

Examples:

Def("Inc", "a", a + 1); Inc(2);
Returns: 3

Def("Add", "a", "b", a + b); [1, 2, 3].Add(_, 2);
Returns: [3, 4, 5]

Def("AddSelf", "b", _ + b); [1, 2, 3].AddSelf(2);
Returns: [3, 4, 5]

Def("Fib", "a", If(a < 2, 1, Fib(a - 1) + Fib(a - 2))); Fib(10);
Returns: 89
Distinct
  1. Array or hierarchical object

Modify given array by filtering out all duplicate values leaving only distinct values in the input array into the result. If given a hierarchical object, applies the function at the level that is one level up from the leaf level.

Examples:

Distinct([1])
Returns: [1]

Distinct([1, 1])
Returns: [1]

Distinct([1, 1, 2, 2])
Returns: [1, 2]

Distinct([1, 1, 2, 2, "a", DateTime(2017), DateTime(2017), "b", DateTime(2016), "a"])
Returns: [1, 2, "a", DateTime(2017), "b", DateTime(2016)]
EventLogById
  1. FilterId (Integer)

Return EventLog corresponding to the provided filter Id.

ModelById
  1. ModelId (Integer)

Return Model corresponding to the provided model Id.

FindRepeats
Repeat
  1. Number of times to repeat (Integer)
  2. Expression to repeat

Repeats the defined expression the defined number of times. Examples:

Repeat(3, "Repeat me!")
Returns:
"Repeat me!"
"Repeat me!"
"Repeat me!"

Repeat(1, 5)
Returns
5
Flatten
  1. Array or hierarchical object

Collects all the actual leaf values from given array, array of arrays or hierarchical object and returns them in a single array. If given a hierarchical object, this function collects actual leaf values instead of leaf level values. Elements in the returned array are in the same order they were found when traversing the input object using depth first search.

Examples:

Flatten(1)
Returns: 1

Flatten([1, 2])
Returns: [1,2]

Flatten([[[1, 2],[3, 4]],[[5, 6]]])
Returns: [1, 2, 3, 4, 5, 6]

Flatten([[1, 2], 3])
Returns: [1, 2, 3]

Flatten([[1,2,3,4], null, [5], [1, null]])
Returns: [1, 2, 3, 4, null, 5, 1, null]
For
  1. Iterated variable name (String)
  2. Initial value for iterated property (object)
  3. Iteration condition expression
  4. Next iteration step expression
  5. Expression to calculate iterated items

Iterates the given expression until the given condition is met, and returns the results of the iterated expressions for every iteration as an array.

Examples:

For("i", 0, i < 4, i + 1, i)
Returns: [0, 1, 2, 3]

For("x", 0, x < 3, x + 1, For("y", 0, y < 3, y + 1, StringJoin(",", [x, y]))
Returns: [["0,0", "0,1", "0,2"], ["1,0", "1,1", "1,2"], ["2,0", "2,1", "2,2"]]

For("i", 0, i < 4, i + 1, DateTime(2010 + i))
Returns: [DateTime(2010), DateTime(2011), DateTime(2012), DateTime(2013)]

For("str", "a", str != "aaaaa", str + "a", str)
Returns: ["a", "aa", "aaa", "aaaa"]
ForEach
  1. Variable to repeat (String)
  2. Array to repeat
  3. Expression to calculate repeated items

Repeats the given expression as many times there are items in the given array. Item in the array is available as the given variable in the expression. Examples:

ForEach("i", [1,2,3], "Value is: " + i)
Returns:
Value is: 1
Value is: 2
Value is: 3

ForEach("myVariable", ["a", "b", "c"], myVariable + myVariable)
Returns:
aa
bb
cc
GetAt
  1. Index (Integer)
  2. Array

Returns element at given index from the beginning of the array. The first item has index zero. If given a hierarchical object, returns the element at given index of the root level array. Throws a calculation exception if the given index does not exist in given object or given object is not an array.

Examples:

GetAt(0, [1,2,3])
Returns: 1

GetAt(1, [[1, 2], [3, 4]])
Returns: [3, 4]

GetAt(1, [[[5, 6]], [[1, 2], [3, 4]]])
Returns: [[1, 2], [3, 4]]

GetAt(1, GetAt(1, [[[5, 6]], [[1, 2], [3, 4]]]))
Returns: [3, 4]
GetAtReverse
  1. Index (Integer)
  2. Array

Same as the GetAt function, except that the index is calculated from the end of the array.

GetValueOfContext
If
  1. Condition expression
  2. True expression
  3. False expression

Evaluates the condition expression and if it's true, returns the value of the second parameter. Otherwise returns the value of the third parameter. Always evaluates only either the second or the third parameter, but never both.

Examples:

If(Now.Second % 2 == 0, "Even second", "Odd second")
Returns:
"Event second" or "Odd second" depending on the time of the evaluation.

For("i", 0, i < 10, i + 1, i).If(_ % 2 == 0, _, _remove)
Returns:
[0, 2, 4, 6, 8]
NOTE: Is equivalent to: For("i", 0, i < 10, i + 1, i).Where(_ % 2 == 0)
IsNull (Boolean)
  1. Value to test (Object)

Return true if the provided value is null, otherwise returns false.

Let
  1. Variable 1 name (String)
  2. Variable 1 value (Object)
  3. Variable 2 name (String)
  4. Variable 2 value (Object)
  5. ...
  6. Expression to evaluate

Set a value for a named variable. Can also be used to set several variable values at once. The variable binding is valid only within the current scope and all its child scopes. There can be any number of variable name and variable value pairs as long as the last parameter is the expression to evaluate.

RemoveLeaves
  1. Hierarchical object

Removes leaves from a hierarchical object.

ReplaceLeafValues
  1. Array or hierarchical object
  2. Variable name used in the iteration (String)
  3. Expression to get the result of each iteration
  4. Number of levels up from the leaf level to operate (Integer)

Replace all leaf values of given array or hierarchical object at given levels up from the leaf level with results of given expression.

Examples:

ReplaceLeafValues([1,2, null], "x", If(IsNull(x), null, x+1), 0)
Result: [2, 4, null]

ReplaceLeafValues([[[1,2],[2,3]],[[3,4],[4,5]]], "x", Flatten(x), 0)
Result: [[[[1],[2]],[[2],[3]]],[[[3],[4]],[[4],[5]]]]

ReplaceLeafValues([[[1,2],[2,3]],[[3,4],[4,5]]], "x", Flatten(x), 1)
Result: [[[1,2],[2,3]],[[3,4],[4,5]]]

ReplaceLeafValues([[[1,2],[2,3]],[[3,4],[4,5]]], "x", Flatten(x), 2)
Result: [[1,2,2,3],[3,4,4,5]]

ReplaceLeafValues([[[1,2],[2,3]],[[3,4],[4,5]]], "x", Flatten(x), 3)
Result: [1,2,2,3,3,4,4,5]
SliceMiddle
  1. Start index (Integer)
  2. End index (Integer)
  3. Levels up in the hierarchy (Integer)
  4. Array
StringJoin
  1. Separator between joined parts (String)
  2. Array of items to join (Array)

Joins the given array of values (converted to strings) by using given separator into a single string. If given a hierarchical object, applies the function as described in at the level that is one level up from the leaf level. The depth of the result is one level less than the object that was given as parameter.

Examples:

StringJoin(", ", [1,null,"foo",DateTime(2017)])
Returns: 1, , foo, 01/01/2017 00:00:00

StringJoin(", ", [[1,2], [3,4]])
Returns: ["1, 2", "3, 4"]
TimeRange
  1. Start (DateTime)
  2. End (DateTime)
  3. Interval (Timespan)

Generates a timestamp array starting from the start timestamp with the defined interval, and ending when the end timestamp is reached. Note that this function only creates timestamps with equal durations, so it's not possible to e.g. create timestamps for each month (to do that, you can use the loops).

Generate datetimes starting from Monday 2017-01-01 and ending to Monday 2017-12-31 including all Mondays between them:
Timerange(Datetime(2018,1,1), Datetime(2018,1,1), Timespan(7))
Variable
  1. Variable name (String)

Gets a variable value for a variable that is defined in the current scope. Useful when there are spaces in the variable name, so they cannot be referenced otherwise in the expressions.

Where
  1. Condition expression
  2. False expression

Returns the context object if the given expression evaluates to true. Otherwise returns the second parameter. The second parameter is optional and it's by default EMPTY.

Examples:

[1,2,3,4].Where(_>2)
Returns: [3,4]

[1,2,3,4].Where(_>2, _+100)
Returns: [101, 102, 3,4]

[1,2,3].[_,_+1]
Returns: [[1, 2], [2, 3], [3, 4]]

[1,2,3].[_,_+1].Where(_>=3)
Returns: [[], [3], [3, 4]]

[1,2,3].[_,_+1].Where(_>=3, _remove)
Returns: [[3], [3, 4]]

Type Specific Properties and Functions

This chapter lists all the object types in the expresssion language and properties and functions that they support. After the property or function name there is the type of the returned object mentioned. Asterisk (*) after the type means that it returns an array of objects.

Array

Array functions Parameters Description
IndexOfSubArray (integer)
  1. Sub-array to search(array)
  2. Array from where to search the sub-array (array)
Returns the indexes of given sub-array (1. parameter) within the given array (2. parameter). If not given, the array in the current context object is used. Returns starting indexes of all the occurrences of given sub-array within given array.

Examples:

[[1,2,3,4,1,2,5]].IndexOfSubArray([1,2])
IndexOfSubArray([1,2], [1,2,3,4,1,2,5])
Return: [0, 4]

[[1,2,3,4,1,2,5]].IndexOfSubArray([1,2,3,4,5])
Returns: []

[[1,2,3,4,1,2,5],[3,4],[0,1,2,3]]:IndexOfSubArray([1,2])
Returns:
[
  HierarchicalArray([1,2,3,4,1,2,5], [0,4]),
  HierarchicalArray([0,1,2,3], [1])
]

AttributeType

Case properties Description
Id (Integer) AttributeType Id.
Name (String) Attribute name.

Case

Case properties Description
Duration (TimeSpan) Case duration, i.e. duration between case start and case end time.
EndTime (DateTime) Case end time, i.e. timestamp of the last event.
Events (Event) All events of the case.
FlowOccurrences (FlowOccurrency) All flow occurrences the case contains.
Flows (Flow) All flows the case goes through.
Id (String) Case Id.
Name (String) Case name
StartTime (DateTime) Case start time, i.e. timestamp of the first event.
Variation (Variation) Variation the case belongs to.
Case functions Parameters Description
Attribute (Object)
  • attribute name (string)
Case attribute value. Case attribute name is provided as a parameter.

Event

Event properties Description
Case (Case) Case the event belongs to.
Id (Integer) Event id.
IndexInCase (Integer) Index (running) number of the event in the case (ordered temporally). The first event has index number 0.
Model (Model) Model the event belongs to.
NextInCase (Event) Temporally next event in the case. For the last event, return EMPTY.
PreviousInCase (Event) Temporally previous event in the case. For the first event, return EMPTY.
TimeStamp (DateTime) Timestamp of the event.
Type (EvenType) Event type of the event.
Event functions Parameters Description
Attribute (object)
  • attribute name (string)
Event attribute value. Event attribute name is provided as a parameter.

EventLog

EventLog is a list of events that is a result of a filtering operation. Also Model contain an EventLog composing of the whole model contents. i.e. filters have been applied yet. EventLogs can be fetched by the filter id using function EventLogById(filterId).

Event properties Description
CaseAttributes (AttributeType*) Used case attribute in the EventLog.
Cases (Case*) Cases that belong to the EventLog.
EventAttributes (AttributeType*) Used event attributes in the EventLog.
Events (Event*) Events that belong to the EventLog.
EventTypes (EventType*) EventTypes in the EventLog.
Flows (Flow*) Flows that the part of the EventLog.
Id EventLog Id.
Model (Model) Model where the EventLog belongs.
Name EventLog name.
Variations (Variation*) Variations that are in the EventLog

EventType

EventType properties Description
Cases (Case*) Cases that contain the EventType.
Count (Integer) Event count that have this EventType.
Events (Event*) Events of that EventType.
IncomingFlows (Flow*) All Flows that start from the EventType.
Id (Integer) EventType Id.
Name (string) EventType name.
OutgoingFlows (Flow*) All Flows that end to the EventType.

Flow

Flow is a combination of two EventTypes where there are FlowOccurrences between them. Unlike FlowOccurrencies, a Flow is not related to a single case. Flowchart shows Flows and EventTypes (not FlowOccurences or Events). In a Case, the may be several FlowOccurrences of a single Flow.

Variation properties Description
Cases (Case*) Cases that contain the flow, i.e. there is a flow occurrence between Flow's starting and ending events.
FlowOccurrences (FlowOccurrence*) Flow occurrences the flow belongs to.
From (EventType) EventType where the Flow starts.
Id (Integer) Flow Id.
Name (String) Identifying name of the Flow.
To (EventType) EventType where the Flow ends.

FlowOccurrence

FlowOccurrence represents a transition from an event to another event in a case. Thus, FlowOccurrence is related to a single case. There is also a FlowOccurrence from the "start" of the case to the first event of the case, and a FlowOccurrence from the last event of the case to the "end" of the case. Corresponding flow is visible in BPMN kind of flowcharts showing separate start and event icons. Thus, there are one more FlowOccurrences in a case than the number of events.

Variation properties Description
Case (Case) Case the current FlowOccurrence belongs to.
Flow (Flow) Corresponding Flow of the current FlowOccurrence.
From (Event) Event where the current FlowOccurrence starts.
Id (Integer) Current FlowOccurrence Id.
Name (String) Identifying name of the current FlowOccurrence.
OccurrenceIndex (Integer) Number tells how many times the current FlowOccurrence has occurred in the case until that point.
To (Event) Event where the current FlowOccurrency ends.

Model

Variation properties Description
CaseAttributes (AttributeType*) CaseAttributes of the model.
EventAttributes (AttributeType*) EventAttributes of the model.
EventLog (EventLog) EventLog of the model. Model EventLog contains all events of the model, i.e. no filters have been applied.
Id (Integer) Model Id.
Name (String) Name of the model.
Project (Project) The Project the current model belong to.

TimeSpan

TimeSpan represents a temporal duration (for example: 5 hours or 8 days). TimeSpan is not bound to calendar time. Difference between two TimeStamps is TimeSpan. TimeStamp added by TimeSpan is TimeStamp.

TimeSpan properties Description
TotalDays (Float) Timespan value in days (one day is 24 hours) (both whole and fractional).
TotalHours (Float) Timespan value in hours (both whole and fractional).
TotalMilliseconds (Float) Timespan value in milliseconds(both whole and fractional).
TotalMinutes (Float) Timespan value in minutes (both whole and fractional).
TotalSeconds (Float) Timespan value in seconds (both whole and fractional).

Variation

Variation properties Description
CaseCount (Integer) Number of cases in the variation.
Cases (Case*) Cases that belong to the variation.
EventTypeCount (Integer) Number of events in the variation.
EventTypes (EventType*) Event types belonging to the variation.
Id (Integer) Variation Id.
UniqueEventTypeCount (Integer) Number of different (unique) event types in the variation.

DateTime

DateTime represents a timestamp.

DateTime properties Description
Day The day of the calendar month represented by the DateTime. Number between 1 and 31.
Hour The hour component of the date represented by the DateTime. Number between 0 and 23.
Millisecond The millisecond component of the date represented by the DateTime. Number between 0 and 999.
Minute The minute component of the date represented by the DateTime. Number between 0 and 59.
Month The calendar month component of the date represented by the DateTime. Number between 1 and 12.
Second The second component of the date represented by the DateTime. Number between 0 and 59.
Year The year component of the date represented by the DateTime. Number between 1 and 9999.
DateTime functions Parameters Description
Round (DateTime)
  • attribute name (TimeSpan)

Rounds the DateTime to the defined TimeSpan.

Example:

Round to the nearest hour:
Round(DateTime(2017, 1, 1, 14, 48), TimeSpan(0, 1))

Expression Examples

See expression examples here: QPR ProcessAnalyzer Expression Examples.