Filtering in QPR ProcessAnalyzer Queries: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
 
(128 intermediate revisions by 2 users not shown)
Line 1: Line 1:
QPR ProcessAnalyzer analysis requests have parameter '''Filter''' which is used to pass a JSON formatted filter definition for the analysis. This filter definition is combined with the stored filter object, which is provided as the '''FilterId''' parameter. Influence analyses have also parameter '''Comparison''' which divides the analyzed data into two parts to compare them in the analysis. Comparison parameter has the same JSON syntax as in the Filter parameter.
QPR ProcessAnalyzer queries for models data can be ''filtered'' to include only selected cases or events to the calculation. The expression query have the parameter '''Filter''' to pass a filter definition. The Root cause analysis has also the parameter '''Comparison''' which divides the analyzed data into two groups to compare them in the analysis. The Comparison parameter has the same structure as in the Filter parameter.


When performing analyses, different filter specifications are applied in the following order (from first to last):
If a filter (or comparison) refers to information that doesn't exist in the model, e.g. non-existing event type names or case attribute values, the non-existing values are ignored. Still, if the [[#Case_attribute_values|CaseAttributeValue]] or [[#Event_attribute_values|EventAttributeValue]] filter refers to an attribute name that doesn't exist, an error is given.
# Filter rules defined by a stored filter (the '''FilterId''' parameter)
# Filter rules defined in the '''Filter''' parameter
# Other filtering related parameters, such as '''SelectedActivities''' or '''SelectedTransitions'''


Filter and Comparison parameters are only supported in the [[Installing QPR ProcessAnalyzer Server#Configure_Web_Service_to_use_In-Memory_or_In-Database_processing|In-Memory core]].
== Filter and Comparison parameters ==
 
=== Filter parameter JSON syntax ===
The filter definition has syntax demonstrated by the following example:
The filter definition has syntax demonstrated by the following example:


Line 15: Line 10:
   Items: [
   Items: [
     {
     {
       type: "IncludeCases",
       Type: "IncludeCases",
       Items: [
       Items: [
         {
         {
Line 22: Line 17:
         },
         },
         {
         {
           type: "caseattributevalue",
           Type: "CaseAttributeValue",
           attribute: "Region",
           Attribute: "Region",
           values: ["Dallas", "Austin"]
           Values: ["Dallas", "Austin"]
         }
         }
       ]
       ]
Line 36: Line 31:
         },
         },
         {
         {
           type: "flow",
           Type: "flow",
           values: [
           Values: [
             {
             {
               from: "Shipment",
               From: "Shipment",
               to: "Invoice"
               To: "Invoice"
             }
             }
           ]
           ]
Line 50: Line 45:
</pre>
</pre>


* Outmost object has a property '''Items''', which is an array of '''SelectionOperation''' objects
The outmost object has a property '''Items''' which is an array of object with following properties:
* SelectionOperation objects have '''Type''' property and possibly other properties. The Type property specifies the type of the filtering operation having the following values:
* '''Type''': Specifies the type of the filtering operation with following options:
** '''IncludeEventTypes''': Include only event types.
** '''IncludeCases''' / '''ExcludeCases''': Includes / excludes cases. All filter rule types can be used with this option.
** '''ExcludeEventTypes''': Exclude event types.
** '''IncludeEvents''' / '''ExcludeEvents''': Includes / excludes events. Only ''Attribute'' filter rule types can be used with this option.
** '''IncludeCases''': Include only cases.
** '''IncludeEventTypes''' / '''ExcludeEventTypes''': Includes / excludes events based on the event type. Only ''Event type'' and ''Expression'' filter rule types can be used with this option.
** '''ExcludeCases''': Exclude cases.
* '''Disabled''': (boolean) Defines whether the filter rule is applied or not. This is used by the UI to temporarily disable filter rule without removing them.
** '''Union''': Select objects that belong to union of all the given child selections.
** '''Intersection''': Select objects that belong to intersection of all the given child selections.
** '''ClearFilters''': Clear filter for given type of objects.
** '''Negate''': Negate the filtered objects of given type.
** '''IncludeCaseAttributes''': Include only given case attributes.
** '''ExcludeCaseAttributes''': Exclude given case attributes.
** '''IncludeEventAttributes''': Include only given event attributes.
** '''ExcludeEventAttributes''': Exclude given event attributes.
** '''Items''' specifies selected model objects. It is used only when the Type is '''IncludeCases''', '''ExcludeCases''', '''IncludeEventTypes''' or '''ExcludeEventTypes'''.
** '''ChildItems''': Specifies the selections to be combined using a set operation. An array of SelectionConfiguration objects. Applicable only when the Type is any of the following: Union, Intersection.
** '''Attributes''': Specifies an array of attribute names. Applicable only when the Type is any of the following: IncludeCaseAttributes, ExcludeCaseAttributes, IncludeEventAttributes, IncludeEventAttributes.
** '''TargetObjectType''': Specifies the type of objects the operation is targeted to. Supported values are '''EventType''' and '''Case'''. It is applicable only when the Type is '''ClearFilters''' or '''Negate'''.


The following chapters list all filter rule types that can be used.
The following chapters list different filter rule types that can be used in the above defined '''Items''' property.


=== Case ===
== Filter Rule Types ==
Filter rule type '''Case''' selects individual cases. It supports property '''Values''' which is an array of case names (strings).
=== Expression ===
Filter rule type '''ExpressionValue''' (for in-memory calculation) or '''SqlExpressionValue''' (for dataframe calculation) selects cases or events that match the given expression. There is property '''Configuration''' which has properties:
* '''Root''': The root expression returning objects that are used to evaluate the ''Expressions'' (see below). If not defined, all the cases in the current event log are used as root objects. The root expression should return following types of objects: (1) for case filters: cases, events, event types, flows or flow occurrences, (2) for event filters: events and (3) for event type filters: event types. The expressions are typically what can be used as chart dimension expressions.
* '''Expressions''': Array of expressions specifying the filter rules. There is the AND logic between the filter rules, so all expressions need to match for the objects to come to the filter. Properties:
** '''Expression''': When filter rule type is ''ExpressionValue'', specifies an eventlog based expression that is evaluated for each root object. When filter rule type is ''SqlExpressionValue'', specifies an SQL expression that is evaluated for each root object.
** '''Values''': Array of values to match to the expression result. Suitable only for strings, numeric and boolean values.
** '''StringifiedValues''': Array of values to match to the expression result, and the values are defined in the [[Stringified_Value_Format|stringified format]]. This has a better support for different data types than in the Values property.
** '''NumberPrecision''': Similar setting as the [[Web_API:_Expression/query#Dimensions|expression analysis dimensions]] have to round numerical type of result of the expression.
** '''DatetimeTruncation''': Similar setting as the [[Web_API:_Expression/query#Dimensions|expression analysis dimensions]] have to round date type of result of the expression.
** '''TimespanPrecision''': Similar setting as the [[Web_API:_Expression/query#Dimensions|expression analysis dimensions]] have to round timespan type of result of the expression. Supported only for expression type ''ExpressionValue''.
** '''Comparison''': Defines type of comparison operation among the following: '''equal''' (default), '''notequal''', '''greaterthan''', '''lessthan''', '''greaterthanorequal''' and '''lessthanorequal'''. When comparison is ''equal'' or ''notequal'', several values can be specified. For other comparison types, there must only be one value. The lower and greater than comparisons work with numbers, datatimes and timespans. In the lower and greater than comparisons, ''null'' values in both sides of the comparison result in a non-match. Rounding or truncation defined by the NumberPrecision, DateTimeTruncation or TimespanPrecision are done before comparison, so do not use them if comparison should be based on the original values.
** '''Columns''': For SqlExpressionValue type, additional calculated columns that can be used in the main expression. Defined as an array of objects with following properties:
*** '''Name''': Column name.
*** '''Expression''': Column expression. In the expression, it's possible to refer to the previous columns.
* '''Variables''': Object specifying key-value pairs, where each pair creates a variable into the expression context where key is the name of the variable and value is its value. The values will be converted to strings. Supported only for expression type ''ExpressionValue''.
 
Examples:


Example:
Select cases named "case1" and "case2".
<pre>
<pre>
{
{
   Type: "Case",
   Type: "ExpressionValue",
   Values: ["case1", "case2", "case3"]
   Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "Name",
        Values: ["case1", "case2"]
      }
    ]
  }
}
}
</pre>
</pre>


=== CaseAttributeTrend ===
Cases where duration is as rounded 3 or 4 days.
Filter rule type '''CaseAttributeTrend''' selects cases having given value in given case attribute at a specific time. Supports the following additional properties:
* '''Attribute''': Name of the case attribute.
* '''TimeStampType''': Specifies how timestamp is calculated for a case. Supported values are: '''CaseStartTime''' (default), '''CaseEndTime''', '''FirstEventTypeOccurrence''' and '''CaseCustomAttributeValue'''
* '''TimeStampCaseAttribute''': Name of the attribute whose value is used as the timestamp of the case.
* '''PeriodLevel''': Specifies the group granularity for the timestamps. Supported values are: '''Day''' (default), '''Week''', '''Month''', '''Quarter''', '''Year'''.
* '''StartDate''': Specifies the start date from which the indexing is started. Defaults to the current date.
* '''Trends''': Specifies the selected value+time combinations. It has the following properties:
** '''Value''': String representation of the value.
** '''Offsets''': An array of integers which specifies which timestamp offsets (counted from the StartDate with PeriodLevel granularity) are selected.
 
Example:
<pre>
<pre>
{
{
   Type: "CaseAttributeTrend",
   Type: "ExpressionValue",
   Attribute: "Region",
   Configuration: {
  PeriodLevel: "Day",
    Root: "Cases",
  StartDate: "2012-01-01",
    Expressions: [
  TimeStampType: "CaseStartTime",
      {
  Trends: [
        Expression: "Duration.TotalDays",
    {
        NumberPrecision: 0,
      Value: "Dallas",
        StringifiedValues: ["43", "44"]
       Offsets: [1]
       }
     }
     ]
   ]
   }
}
}
</pre>
</pre>


=== CaseAttributeValue ===
Cases where duration is as rounded 3 or 4 days.
Filter rule type '''CaseAttributeValue''' selects cases having given value in given case attribute. Properties:
* '''Attribute''': Case attribute name.
* '''Values''': Array of case attribute values in string format.
 
Example:
<pre>
<pre>
{
{
   Type: "CaseAttributeValue",
   Type: "ExpressionValue",
   Attribute: "Region",
   Configuration: {
  Values: ["Dallas", "Austin", "New York"]
    Root: "Cases",
    Expressions: [
      {
        Expression: "Duration",
        TimespanPrecision: "day",
        StringifiedValues: ["73.00:00:00.000", "74.00:00:00.000"]
      }
    ]
  }
}
}
</pre>
</pre>


=== Duration ===
Cases that have started in October or November 2020.
Filter rule type '''Duration''' selects cases or flows having any of the selected durations. Properties:
* '''Durations''': Array of duration group indexes (integers).
* '''DurationGranularity''': Number of seconds each group index represents. Defaults to one day (60 * 60 * 24).
* '''DurationMaximum''': Maximum duration group index. Any duration longer than the duration represented by the maximum index will be put into the duration group of the maximum index. Defaults to 100.
* '''FocusFlow''': If flow duration is being selected, identifies the flow whose duration is measured. A '''FlowItem''' object.
 
Example:
<pre>
<pre>
{
{
   Type: "Duration",
   Type: "ExpressionValue",
   Durations: [50],
   Configuration: {
  Granularity: 60,
    Root: "Cases",
  MaximumDuration: 50,
    Expressions: [
  FocusFlow: { From: "et1", To: "et2" }
      {
        Expression: "StartTime",
        DatetimeTruncation: "month",
        StringifiedValues: ["22020-10-01T00:00:00.000", "22020-11-01T00:00:00.000"]
      }
    ]
  }
}
}
</pre>
</pre>


=== EventAttributeTrend ===
Selects cases whose duration is longer than one day.
Selection item '''EventAttributeTrend''' selects cases having at least one event having given value in given event attribute at a specific time. Supports the following additional properties:
* '''Attribute''': Name of the event attribute.
* '''PeriodLevel''': Specifies the group granularity for the timestamps. Supported values are: '''Day''' (default), '''Week''', '''Month''', '''Quarter''', '''Year'''
* '''StartDate''': Specifies the start date from which the indexing is started. Defaults to the current date.
* '''Trends''': Specifies the selected value+time combinations. Properties:
** '''Value''': String representation of the value.
** '''Offsets''': An array of integers which specifies which timestamp offsets (counted from the StartDate with PeriodLevel granularity) are selected.
 
Example:
<pre>
<pre>
{
{
   Type: "EventAttributeTrend",
   Type: "ExpressionValue",
   Attribute: "Unit",
   Configuration: {
  PeriodLevel: "Day",
    Root: "Cases.Where(Duration.TotalDays > 1)"
  StartDate: "2012-01-01",
   }
   Trends: [
    {
      Value: "UnitA",
      Offsets: [9]
    }
  ]
}
}
</pre>
</pre>


=== EventAttributeValue ===
Same as previous using the ''Comparison'' property:
Filter rule type '''EventAttributeValue''' selects events having given value in given event attribute. Supports the following additional properties:
* '''Attribute''': Name of the event attribute.
* '''Values''': An array of event attribute values in string format.
 
Example:
<pre>
<pre>
{
{
   Type: "EventAttributeValue",
   Type: "ExpressionValue",
   Attribute: "Unit",
   Configuration: {
  Values: ["UnitA"]
    Root: "Cases",
    Expressions: [
      {
        Expression: "Duration.TotalDays",
        Comparison: "greaterthan",
        Values: [1]
      }
    ]
  }
}
}
</pre>
</pre>


=== EventType ===
All Cases that have started before year 2020:
Filter rule type '''EventType''' selects individual event types. It has property '''Values'''  which is an array of event type names.
 
Example:
<pre>
<pre>
{
{
   Type: "EventType",
   Type: "ExpressionValue",
   Values: ["Sales Order Created", "Payment Received", "Delivery Sent"]
   Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "StartTime",
        Comparison: "lessthan",
        StringifiedValues: ["22020-01-01T00:00:00.000"]
      }
    ]
  }
}
}
</pre>
</pre>


=== EventTypeTrend ===
Returns all cases that are conformant with the specified BPNM model.
Selects cases having at least one event occurrence of given event type at a specific time. Supports the following additional properties:
* '''PeriodLevel''': Specifies the group granularity for the timestamps. Supported values are '''Day''' (default), '''Week''', '''Month''', '''Quarter''', '''Year'''.
* '''StartDate''': Specifies the start date from which the indexing is started. Defaults to the current date.
* '''Trends''': Specifies the selected value+time combinations. It has the following properties:
** '''Value''': String representation of the value.
** '''Offsets''': An array of integers which specifies which timestamp offsets (counted from the StartDate with PeriodLevel granularity) are selected.
 
Example:
<pre>
<pre>
{
{
   Type: "EventTypeTrend",
   Type: "ExpressionValue",
   PeriodLevel: "Day",
   Configuration: {
  StartDate: "2012-01-01",
    Variables: {
  Trends: [
      bpmnXml: "<XML BPMN model>"
     {
    },
      Value: "Shipment",
     Root: "Let(\"myConformanceModel\", DesignModelFromXml(bpmnXml));Cases.Where(IsConformant(myConformanceModel));"
      Offsets: [3]
  }
    }
  ]
}
}
</pre>
</pre>


=== ExpressionValue ===
Pass date values as ticks and convert them into date objects (that are used in the actual comparison).
Filter rule type '''ExpressionValue''' selects cases that match the given expression. It has property '''Configuration''' which contains the following properties:
# '''Root''': Specifies the root expression returning objects to be used as context for evaluating the expressions. If not defined, all the cases in the current event log are used as root objects. Allowed types for the root expression are '''Case''', '''Event''', '''EventType''', '''Variation''', '''Flow''', '''FlowOccurrence'''.
# '''Expressions''': An array of expressions specifying the actual filter. All the root objects for which all the selection expression evaluations succeed will be coerced into a case and returned as selection. If not defined, all the objects returned from the Root expression will be selected. Each expression to be matched in a selection is defined as a separate JSON object. Defines an expression together with its selected values that will be used in the selection of actual model objects. Supports the following properties:
## '''Expression''': Expression that is evaluated using the context of the root object.
## '''Values''': An array of values to match to the expression result.
 
Examples:
<pre>
<pre>
{
{
Line 230: Line 205:
     Expressions: [
     Expressions: [
       {
       {
         Expression: "Name",
         Expression: "myDatetimeAttribute",
         Values: ["case1", "case2"]
        ValueConversionExpression: "_.DateTimeFromTicks(_)",
         Values: [636214968000000000, 636239160000000000, 636291828000000000]
       }
       }
     ]
     ]
   }
   }
}
}
</pre>


Select cases named "case1" and "case2".
<pre>
 
{
{
   Type: "ExpressionValue",
   Type: "SqlExpressionValue",
   Configuration: {
   Configuration: {
     Root: "Cases.Where(Duration.TotalDays > 1)"
     Root: "Cases",
    Expressions: [{
      Expression: "AggregateFrom(Events, \"Count\")",
      Values: [4,5]
    }]
   }
   }
}
}
Selects cases whose duration is longer than one day.
</pre>
</pre>


=== Flow ===
=== Attribute ===
Filter rule type '''Flow''' selects individual flows. It has property '''Flows''' which selects an array of objects with following properties:
Filter rule type '''Attribute''' selects events having given event attribute values. This filter rule is available only when processing method is DataFrame, and when filter operation type is ''IncludeEvents''/''ExcludeEvents''. Properties:  
* '''From''': Event type name which starts the flow.
* '''Attribute''': Event attribute name.
* '''To''': Event type name into which the flow goes.
* '''Values''': Array of event attribute values. Suitable only for string, integer and boolean values.
* '''Occurrence''': Occurrence index of the selected flow within its case. If not specified, represents all occurrences.  
* '''StringifiedValues''': Array of event attribute values in the [[Stringified_Value_Format|stringified format]]. Better support for different data types. Note that due to the equality comparison, float values cannot be used.
 
Examples:
<pre>
{
  Type: "Attribute",
  Attribute: "Role",
  Values: ["Consultant", "Sales", "Support"]
}
</pre>
<pre>
{
  Type: "Attribute",
  Attribute: "Automation",
  StringifiedValues: ["0Manual"]
}
</pre>
 
=== Case attribute value ===
Filter rule type '''CaseAttributeValue''' selects cases having given value in given case attribute. Properties:
* '''Attribute''': Case attribute name.
* '''Values''': Array of case attribute values. Suitable only for string, integer and boolean values.
* '''StringifiedValues''': Array of case attribute values in the [[Stringified_Value_Format|stringified format]]. Better support for different data types. Note that due to the equality comparison, float values cannot be used.


Example:
Example:
<pre>
<pre>
{
{
   Type: "Flow",
   Type: "CaseAttributeValue",
   Flows: [ {From: "et2", To: "et3"} ]
   Attribute: "Region",
  Values: ["Dallas", "Austin", "New York"]
}
</pre>
 
<pre>
{
  Type: "CaseAttributeValue",
  Attribute: "Region",
  StringifiedValues: ["0Dallas", "0Austin", "0New York"]
}
}
</pre>
</pre>


=== PathLength ===
=== Event attribute value ===
Filter rule type '''PathLength''' selects cases having the given variation or process path lengths. It has property '''Values''' which is an array of lengths (integers in strings).
Filter rule type '''EventAttributeValue''' selects cases having events with given event attribute values. Properties:
* '''Attribute''': Name of the event attribute.
* '''Values''': An array of event attribute values. Suitable only for string, integer and boolean values.
* '''StringifiedValues''': Array of event attribute values in the [[Stringified_Value_Format|stringified format]]. Better support for different data types. Note that due to the equality comparison, float values cannot be used.


Example:
Example:
<pre>
<pre>
{
{
   Type: "PathLength",
   Type: "EventAttributeValue",
   Values: ["3"]
  Attribute: "Organization",
   Values: ["Organization 1", "Organization 2"]
}
</pre>
 
<pre>
{
  Type: "EventAttributeValue",
  Attribute: "Organization",
  StringifiedValues: ["0Organization 1", "0Organization 2"]
}
}
</pre>
</pre>


=== ProcessPath ===
=== Event type ===
Selects individual process paths that is selected from Path Analysis. Supports the following additional properties:
Filter rule type '''EventType''' selects cases containing selected event types (Type=IncludeCases/ExcludeCases) or selects event types (Type=IncludeEventTypes/ExcludeEventTypes). It has property '''Values''' which is an array of event type names.
* '''Paths''': An array of arrays of event type names (strings). Each item in the top level array represents one selected process path section.
* '''RootEventType''': Name of the event type from which the paths start. Defaults to the most common starter event type of the process.
* '''ReversedPaths''': Is the path direction towards successors (false) or predecessors (true). Defaults to successors.


Example:
Example:
<pre>
<pre>
{
{
   Type: "ProcessPath",
   Type: "EventType",
   RootEventType: "et1",
   Values: ["Sales Order Created", "Payment Received", "Delivery Sent"]
  Paths: [["et1", "et2", "et3"]]
}
}
</pre>
</pre>


=== Variation ===
=== Variation ===
Filter rule type '''Variation''' selects individual variations. It has the property '''Paths''' which is an array of variations. Each variation is a string array of event type names in the variation.
Filter rule type '''Variation''' selects cases belonging to selected variations. It has the property '''Paths''' which is an array of variations. Each variation is a string array of event type names in the variation.


Example:
Example:
Line 303: Line 322:
</pre>
</pre>


=== Examples ===
=== Flow ===
Filter rule type '''Flow''' selects cases having the defined flows. It has property '''Flows''' which selects an array of objects with following properties:
* '''From''': Event type name which starts the flow.
* '''To''': Event type name into which the flow goes.
* '''Occurrence''': Zero-based occurrence index of the selected flow within its case. If not specified, represents all occurrences.
 
Example:
<pre>
{
  Type: "Flow",
  Flows: [ {From: "EventType1", To: "EventType2", "Occurrence": 1} ]
}
</pre>
 
=== Case ID ===
Filter rule type '''Case''' selects individual cases. It supports property '''Values''' which is an array of case ID's (strings).
 
Example:
<pre>
{
  Type: "Case",
  Values: ["case1", "case2", "case3"]
}
</pre>


Same example in the whole JSON configuration:
<pre>
<pre>
{
{
   Items: [
   Items: [
     {
     {
       Type: "Union",
       Type: "IncludeCases",
       ChildItems: [
       Items: [
         {
         {
           Items: [
           Type: "Case",
            {
           Values: ["case1", "case2", "case3"]
              Type: "IncludeCases",
              Items: [
                {
                  Type: "Case",
                  Values: ["c1", "c3"]
                }
              ]
            }
          ]
        },
        {
           Items: [
            {
              Type: "IncludeCases",
              Items: [
                {
                  Type: "Case",
                  Values: ["c1"]
                }
              ]
            },
            {
              Type: "Negate",
              TargetObjectType: "Case"
            }
          ]
         }
         }
       ]
       ]

Latest revision as of 12:03, 14 September 2023

QPR ProcessAnalyzer queries for models data can be filtered to include only selected cases or events to the calculation. The expression query have the parameter Filter to pass a filter definition. The Root cause analysis has also the parameter Comparison which divides the analyzed data into two groups to compare them in the analysis. The Comparison parameter has the same structure as in the Filter parameter.

If a filter (or comparison) refers to information that doesn't exist in the model, e.g. non-existing event type names or case attribute values, the non-existing values are ignored. Still, if the CaseAttributeValue or EventAttributeValue filter refers to an attribute name that doesn't exist, an error is given.

Filter and Comparison parameters

The filter definition has syntax demonstrated by the following example:

{
  Items: [
    {
      Type: "IncludeCases",
      Items: [
        {
          Type: "EventType",
          Values: ["Sales Order Created", "Payment Received"]
        },
        {
          Type: "CaseAttributeValue",
          Attribute: "Region",
          Values: ["Dallas", "Austin"]
        }
      ]
    },
    {
      Type: "ExcludeCases",
      Items: [
        {
          Type: "Case",
          Values: ["Case1", "Case2", "Case3"]
        },
        {
          Type: "flow",
          Values: [
            {
              From: "Shipment",
              To: "Invoice"
            }
          ]
        }
      ]
    }
  ]
}

The outmost object has a property Items which is an array of object with following properties:

  • Type: Specifies the type of the filtering operation with following options:
    • IncludeCases / ExcludeCases: Includes / excludes cases. All filter rule types can be used with this option.
    • IncludeEvents / ExcludeEvents: Includes / excludes events. Only Attribute filter rule types can be used with this option.
    • IncludeEventTypes / ExcludeEventTypes: Includes / excludes events based on the event type. Only Event type and Expression filter rule types can be used with this option.
  • Disabled: (boolean) Defines whether the filter rule is applied or not. This is used by the UI to temporarily disable filter rule without removing them.

The following chapters list different filter rule types that can be used in the above defined Items property.

Filter Rule Types

Expression

Filter rule type ExpressionValue (for in-memory calculation) or SqlExpressionValue (for dataframe calculation) selects cases or events that match the given expression. There is property Configuration which has properties:

  • Root: The root expression returning objects that are used to evaluate the Expressions (see below). If not defined, all the cases in the current event log are used as root objects. The root expression should return following types of objects: (1) for case filters: cases, events, event types, flows or flow occurrences, (2) for event filters: events and (3) for event type filters: event types. The expressions are typically what can be used as chart dimension expressions.
  • Expressions: Array of expressions specifying the filter rules. There is the AND logic between the filter rules, so all expressions need to match for the objects to come to the filter. Properties:
    • Expression: When filter rule type is ExpressionValue, specifies an eventlog based expression that is evaluated for each root object. When filter rule type is SqlExpressionValue, specifies an SQL expression that is evaluated for each root object.
    • Values: Array of values to match to the expression result. Suitable only for strings, numeric and boolean values.
    • StringifiedValues: Array of values to match to the expression result, and the values are defined in the stringified format. This has a better support for different data types than in the Values property.
    • NumberPrecision: Similar setting as the expression analysis dimensions have to round numerical type of result of the expression.
    • DatetimeTruncation: Similar setting as the expression analysis dimensions have to round date type of result of the expression.
    • TimespanPrecision: Similar setting as the expression analysis dimensions have to round timespan type of result of the expression. Supported only for expression type ExpressionValue.
    • Comparison: Defines type of comparison operation among the following: equal (default), notequal, greaterthan, lessthan, greaterthanorequal and lessthanorequal. When comparison is equal or notequal, several values can be specified. For other comparison types, there must only be one value. The lower and greater than comparisons work with numbers, datatimes and timespans. In the lower and greater than comparisons, null values in both sides of the comparison result in a non-match. Rounding or truncation defined by the NumberPrecision, DateTimeTruncation or TimespanPrecision are done before comparison, so do not use them if comparison should be based on the original values.
    • Columns: For SqlExpressionValue type, additional calculated columns that can be used in the main expression. Defined as an array of objects with following properties:
      • Name: Column name.
      • Expression: Column expression. In the expression, it's possible to refer to the previous columns.
  • Variables: Object specifying key-value pairs, where each pair creates a variable into the expression context where key is the name of the variable and value is its value. The values will be converted to strings. Supported only for expression type ExpressionValue.

Examples:

Select cases named "case1" and "case2".

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "Name",
        Values: ["case1", "case2"]
      }
    ]
  }
}

Cases where duration is as rounded 3 or 4 days.

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "Duration.TotalDays",
        NumberPrecision: 0,
        StringifiedValues: ["43", "44"]
      }
    ]
  }
}

Cases where duration is as rounded 3 or 4 days.

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "Duration",
        TimespanPrecision: "day",
        StringifiedValues: ["73.00:00:00.000", "74.00:00:00.000"]
      }
    ]
  }
}

Cases that have started in October or November 2020.

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "StartTime",
        DatetimeTruncation: "month",
        StringifiedValues: ["22020-10-01T00:00:00.000", "22020-11-01T00:00:00.000"]
      }
    ]
  }
}

Selects cases whose duration is longer than one day.

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases.Where(Duration.TotalDays > 1)"
  }
}

Same as previous using the Comparison property:

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "Duration.TotalDays",
        Comparison: "greaterthan",
        Values: [1]
      }
    ]
  }
}

All Cases that have started before year 2020:

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "StartTime",
        Comparison: "lessthan",
        StringifiedValues: ["22020-01-01T00:00:00.000"]
      }
    ]
  }
}

Returns all cases that are conformant with the specified BPNM model.

{
  Type: "ExpressionValue",
  Configuration: {
    Variables: {
      bpmnXml: "<XML BPMN model>"
    },
    Root: "Let(\"myConformanceModel\", DesignModelFromXml(bpmnXml));Cases.Where(IsConformant(myConformanceModel));"
  }
}

Pass date values as ticks and convert them into date objects (that are used in the actual comparison).

{
  Type: "ExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [
      {
        Expression: "myDatetimeAttribute",
        ValueConversionExpression: "_.DateTimeFromTicks(_)",
        Values: [636214968000000000, 636239160000000000, 636291828000000000]
      }
    ]
  }
}
{
  Type: "SqlExpressionValue",
  Configuration: {
    Root: "Cases",
    Expressions: [{
      Expression: "AggregateFrom(Events, \"Count\")",
      Values: [4,5]
    }]
  }
}

Attribute

Filter rule type Attribute selects events having given event attribute values. This filter rule is available only when processing method is DataFrame, and when filter operation type is IncludeEvents/ExcludeEvents. Properties:

  • Attribute: Event attribute name.
  • Values: Array of event attribute values. Suitable only for string, integer and boolean values.
  • StringifiedValues: Array of event attribute values in the stringified format. Better support for different data types. Note that due to the equality comparison, float values cannot be used.

Examples:

{
  Type: "Attribute",
  Attribute: "Role",
  Values: ["Consultant", "Sales", "Support"]
}
{
  Type: "Attribute",
  Attribute: "Automation",
  StringifiedValues: ["0Manual"]
}	

Case attribute value

Filter rule type CaseAttributeValue selects cases having given value in given case attribute. Properties:

  • Attribute: Case attribute name.
  • Values: Array of case attribute values. Suitable only for string, integer and boolean values.
  • StringifiedValues: Array of case attribute values in the stringified format. Better support for different data types. Note that due to the equality comparison, float values cannot be used.

Example:

{
  Type: "CaseAttributeValue",
  Attribute: "Region",
  Values: ["Dallas", "Austin", "New York"]
}
{
  Type: "CaseAttributeValue",
  Attribute: "Region",
  StringifiedValues: ["0Dallas", "0Austin", "0New York"]
}

Event attribute value

Filter rule type EventAttributeValue selects cases having events with given event attribute values. Properties:

  • Attribute: Name of the event attribute.
  • Values: An array of event attribute values. Suitable only for string, integer and boolean values.
  • StringifiedValues: Array of event attribute values in the stringified format. Better support for different data types. Note that due to the equality comparison, float values cannot be used.

Example:

{
  Type: "EventAttributeValue",
  Attribute: "Organization",
  Values: ["Organization 1", "Organization 2"]
}
{
  Type: "EventAttributeValue",
  Attribute: "Organization",
  StringifiedValues: ["0Organization 1", "0Organization 2"]
}

Event type

Filter rule type EventType selects cases containing selected event types (Type=IncludeCases/ExcludeCases) or selects event types (Type=IncludeEventTypes/ExcludeEventTypes). It has property Values which is an array of event type names.

Example:

{
  Type: "EventType",
  Values: ["Sales Order Created", "Payment Received", "Delivery Sent"]
}

Variation

Filter rule type Variation selects cases belonging to selected variations. It has the property Paths which is an array of variations. Each variation is a string array of event type names in the variation.

Example:

{
  Type: "Variation",
  Paths: [
    ["Activity 1", "Activity 2", "Activity 3"],
    ["Activity 3"],
    ["Activity 2", "Activity 4"]
  ]
}

Flow

Filter rule type Flow selects cases having the defined flows. It has property Flows which selects an array of objects with following properties:

  • From: Event type name which starts the flow.
  • To: Event type name into which the flow goes.
  • Occurrence: Zero-based occurrence index of the selected flow within its case. If not specified, represents all occurrences.

Example:

{
  Type: "Flow",
  Flows: [ {From: "EventType1", To: "EventType2", "Occurrence": 1} ]
}

Case ID

Filter rule type Case selects individual cases. It supports property Values which is an array of case ID's (strings).

Example:

{
  Type: "Case",
  Values: ["case1", "case2", "case3"]
}

Same example in the whole JSON configuration:

{
  Items: [
    {
      Type: "IncludeCases",
      Items: [
        {
          Type: "Case",
          Values: ["case1", "case2", "case3"]
        }
      ]
    }
  ]
}