Model Filters¶
Model filters are set up as instances of data/ModelFilterCriteria
with the following properties:
| Property | Description |
|---|---|
name |
The name is used by the macro function |
type |
The model on which the filter is applied |
criteria.attribute |
attribute name of the applied model |
criteria.conditional_operator |
optional: takes a boolean AND, OR NOT to apply to next criteria |
criteria.condition |
see list below for options |
criteria.value |
filter condition value of attribute to check against |
criteria.condition can be:
| Field Name | Description | GUI Field Name |
|---|---|---|
equalsIgnoreCase |
Case insensitive exact match. | Equals |
isexactly |
Case sensitive exact match. | Equals Exactly |
containsIgnoreCase |
Case insensitive substring match. | Contains |
contains |
Case sensitive substring match. | Contains Exactly |
regex_search |
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, individualcriteriaare evaluated to a value:TrueorFalse - The
filter-name, criteria are combined with aconditional_operator(e.g. booleanAND) to yield theresultvalue:trueorfalse - Filters will evaluate each of the criteria for the specified
type.
Below is an instance of
data/ModelFilterCriteriafortypeisdevice/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/ModelFilterCriteriawithnameis “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}
- The
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:
nameofdata/ModelFilterCriteriafield 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
criteriaoperating on thetypemodel - 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": [ "IsaiahL@tobuild.onsoft.com", "PattiF@tobuild.onsoft.com", "LidiaH@tobuild.onsoft.com", "pietman@tobuild.onsoft.com", "HenriettaM@tobuild.onsoft.com" ], "model_filter_criteria_direction": "up", "hierarchy_friendly_path": "sys.hcs.CS-P.CS-NB.RND.East.AlterLake" }