Model Filters#
Model filters are set up as instances of data/ModelFilterCriteria
with the following properties:
Property |
Description |
---|---|
|
The name is used by the macro function |
|
The model on which the filter is applied |
|
attribute name of the applied model |
|
optional: takes a boolean AND, OR NOT to apply to next criteria |
|
see list below for options |
|
filter condition value of attribute to check against |
criteria.condition
can be:
Field Name |
Description |
GUI Field Name |
---|---|---|
|
Case insensitive exact match. |
Equals |
|
Case sensitive exact match. |
Equals Exactly |
|
Case insensitive substring match. |
Contains |
|
Case sensitive substring match. |
Contains Exactly |
|
Regular expression |
Regex Search |
The macro functions take a Model Filter name as input.
Match Model Filter Criteria#
fn.match_model_filter_criteria: Given input context data and a model filter criteria instance
name
, return a dictionary of output that contains aresult
.Syntax: {{fn.match_model_filter_criteria <input-data>,<filter-name> }}
In the Model Filter Criteria:
The
filter-name
, individualcriteria
are evaluated to a value:True
orFalse
The
filter-name
, criteria are combined with aconditional_operator
(e.g. booleanAND
) to yield theresult
value:true
orfalse
Filters will evaluate each of the criteria for the specified
type
.
Below is an instance of
data/ModelFilterCriteria
fortype
isdevice/msgraph/MsolUser
:"data": { "type": "device/msgraph/MsolUser", "description": "Multi Level Filter", "name": "Multi Level Filter", "criteria": [ { "attribute": "City", "condition": "isexactly", "value": "Cape Town", "conditional_operator": "AND" }, { "attribute": "Address", "condition": "contains", "value": "Bellville" } ] }
Example
Output
data/ModelFilterCriteria
withname
is “Multi Level Filter” as in example above.Input context data contains:
{"user_details": { City": "Cape Town", ... Address": "City of Bellville", ... }
Function call:
{{fn.match_model_filter_criteria user_details.City, 'Multi Level Filter' }}
{"output": "[City] 'Cape Town' isexactly 'Cape Town' = True\n [Address] 'City of Bellville' contains 'Bellville' = True", "result": true}
Instances that match Model Filter Criteria#
fn.instances_match_model_filter_criteria:
Syntax:
{{fn.instances_match_model_filter_criteria <model filter criteria name>,<field name>,<direction>}}
Given:
model filter criteria name:
name
ofdata/ModelFilterCriteria
field name: a field name from the model filter criteria instance
type
. The match results will be a list of this field, with the list calledmodel_match_list
.The model filter can contain one or multiple
criteria
operating on thetype
model - with multiple criteria also combined with a booleanconditional_operator
.direction: optional search direction. Default is
above
, which is upwards and excludes the current hierarchy if it is not the top hierarchy.
Return:
Input model filter and query details and result
model_match_list
.
Example macro:
{{ fn.instances_match_model_filter_criteria CityTulsa,username,up }}
Example output:
{ "model_filter_criteria_field": "username", "model_filter_criteria_name": "CityTulsa", "hierarchy": "nnf525b7e04a4a001480cfnn", "model_filter_criteria": { "usage": "Test", "type": "data/User", "name": "Demo Criteria City = Tulsa", "criteria": [ { "attribute": "city", "condition": "isexactly", "value": "Tulsa" } ] }, "model_filter_macro": "{# data.User.* || direction:up #}", "model_match_list": [ "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]" ], "model_filter_criteria_direction": "up", "hierarchy_friendly_path": "sys.hcs.CS-P.CS-NB.RND.East.AlterLake" }
Builds a macro for filtering dropdown choices#
fn.build_filter_macro: Given 2 mandatory input parameters:
a
a
return
Examples:
Example |
Output |
---|---|