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, individualcriteriaare evaluated to a value:TrueorFalseThe
filter-name, criteria are combined with aconditional_operator(e.g. booleanAND) to yield theresultvalue:trueorfalseFilters 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}
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" }
Builds a macro for filtering dropdown choices#
fn.build_filter_macro: Given 2 mandatory input parameters:
a
a
return
Examples:
Example |
Output |
|---|---|