QPR ProcessAnalyzer Expression Examples: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
The following examples have an EventLog with filter id 1 as a starting point. All KPI analyses also have an EventLog as a starting point, so expression written after the "EventLogById(1)." is a valid expression for KPI Analyses.
The following examples assume that there is a filter with id 1. point. All KPI analyses also have an EventLog as a starting point, so expression written after the "EventLogById(1)." is a valid expression for KPI Analyses.


Get all event types that appear among the events:
Get all event types that appear among the events:
Line 6: Line 6:
</pre>
</pre>


Get a hierarchical array, where the upper level are event types and the leaf level are events:
Same as previous, except return event type names (Strings):
<pre>
<pre>
EventLogById(1).EventTypes.Events
EventLogById(1).EventTypes.Name
</pre>
</pre>


Get a hierarchical array, where the upper level are EventTypes and the leaf level are Events:
<pre>
<pre>
EventLogById(1).EventTypes:Events.Type
EventLogById(1).EventTypes.Events
</pre>
</pre>


Get a hierarchical array, where the upper level are EventTypes and the leaf level are also EventTypes (all branches contain same EventTypes):
<pre>
<pre>
EventLogById(1).EventTypes:Events.Type.Name
EventLogById(1).EventTypes:Events.Type
</pre>
</pre>


Line 23: Line 25:
</pre>
</pre>


List all Events as leaf nodes which timestamp is after 2012-01-01:
<pre>
<pre>
EventLogById(1).EventTypes:Events.Where(Timestamp > DateTime(2012,1,1))
EventLogById(1).EventTypes:Events.Where(Timestamp > DateTime(2012,1,1))
</pre>
</pre>


Calculates count of Events in the leaf nodes:
<pre>
<pre>
Count(EventLogById(1).EventTypes:Events.Where(Timestamp > DateTime(2012,1,1)))
Count(EventLogById(1).EventTypes:Events.Where(Timestamp > DateTime(2012,1,1)))
</pre>
</pre>


Events are ordered beginning from the last one:
<pre>
<pre>
EventLogById(1).EventTypes.OrderByDescending(Events, Timestamp)
EventLogById(1).EventTypes.OrderByDescending(Events, Timestamp)
</pre>
</pre>


Same as the previous but with explicit context specified:
<pre>
<pre>
EventLogById(1).EventTypes.OrderByDescending(_Events, _Timestamp)
EventLogById(1).EventTypes.OrderByDescending(_.Events, _.Timestamp)
</pre>
</pre>


Shows all event types in a single comma separated string list:
<pre>
<pre>
EventLogById(1).(StringJoin(", ", EventTypes.Name))
EventLogById(1).(StringJoin(", ", EventTypes.Name))
</pre>
</pre>


Same as the previous, except in addition the EventTypes are ordered by name:
<pre>
<pre>
EventLogById(1).(StringJoin(", ", OrderByDescending(EventTypes, Name).Name))
EventLogById(1).(StringJoin(", ", OrderByDescending(EventTypes, Name).Name))

Revision as of 14:44, 14 December 2017

The following examples assume that there is a filter with id 1. point. All KPI analyses also have an EventLog as a starting point, so expression written after the "EventLogById(1)." is a valid expression for KPI Analyses.

Get all event types that appear among the events:

EventLogById(1).EventTypes

Same as previous, except return event type names (Strings):

EventLogById(1).EventTypes.Name

Get a hierarchical array, where the upper level are EventTypes and the leaf level are Events:

EventLogById(1).EventTypes.Events

Get a hierarchical array, where the upper level are EventTypes and the leaf level are also EventTypes (all branches contain same EventTypes):

EventLogById(1).EventTypes:Events.Type
EventLogById(1).EventTypes:Events.TimeStamp

List all Events as leaf nodes which timestamp is after 2012-01-01:

EventLogById(1).EventTypes:Events.Where(Timestamp > DateTime(2012,1,1))

Calculates count of Events in the leaf nodes:

Count(EventLogById(1).EventTypes:Events.Where(Timestamp > DateTime(2012,1,1)))

Events are ordered beginning from the last one:

EventLogById(1).EventTypes.OrderByDescending(Events, Timestamp)

Same as the previous but with explicit context specified:

EventLogById(1).EventTypes.OrderByDescending(_.Events, _.Timestamp)

Shows all event types in a single comma separated string list:

EventLogById(1).(StringJoin(", ", EventTypes.Name))

Same as the previous, except in addition the EventTypes are ordered by name:

EventLogById(1).(StringJoin(", ", OrderByDescending(EventTypes, Name).Name))


List of all the Starter flows in a model from filterId=1:

RemoveLeaves(EventLogById(1).Flows:From.Where(IsNull(_)))

Go through the model recursively using the flows:

RemoveLeaves(EventLogById(1).Flows:From.Where(IsNull(_))).To.OutgoingFlows.To.OutgoingFlows.To

Traverse the model using events:

RemoveLeaves(EventLogById(1).Flows:From.Where(IsNull(_))).FlowOccurrences.To.NextInCase.NextInCase.NextInCase

All case attribute values within the model grouped by case attribute types:

Let("cases", EventLogById(1).Cases, EventLogById(1).CaseAttributes:(Let("attribute", _, cases.Attribute(attribute))))

All event attribute values within the model grouped by event attribute types:

Let("events", EventLogById(1).Events, EventLogById(1).EventAttributes:(Let("attribute", _, events.Attribute(attribute))))

Define new user defined functions:

Def("First", "a", GetAt(0, a));
Def("Second", "a", GetAt(1, a));

Array(First(a), Second(a))
Def("x", "a", Distinct(RecurseLeaves(OrderBy(EventLogById(a).Cases.Events, Type.Name), Type.Name)))

Function definition that uses itself, i.e. recursive functions:

Def("Fib", "a", If(a < 2, 1, Fib(a - 1) + Fib(a - 2)));
For("i", 0, i < 10, i + 1, Fib(i));
Models.StringJoin(":", [Id, Name])
Models.[Id, Name]