-
Notifications
You must be signed in to change notification settings - Fork 5
Operators
For a list of built-in JSONLogic operators see https://jsonlogic.com/operations.html.
PBI Inspector adds additional operators beyond those provided by the JSONLogic library.
Counts the number of items in an array.
Accepts two JSON array parameters, treats them as non-ordered sets, and returns a JSON array representing the set difference between the first and the second parameter.
Accepts a json pointer string and parses stringified JSON on the right of a '>' character. The drillvar operator was needed in V1 of PBI Inspector due to the large amount the escaped json in the report.json file. It is less relevant for PBI Inspector V2 but still useful for querying escaped json such as in the Deneb custom visual definition.
Accepts two JSON array parameters, treats them as non-ordered sets, and determines if they are equal.
Accepts two JSON array parameters, treat them as non-ordered sets, and returns a JSON array representing the intersection of both sets.
The part operator returns a part corresponding to a PBIR file path within the report definition folder.
The following part or parts can be returned (note that the part names are case-sensitive):
- Report: returns the part with the "report.json" file path
- ReportExtensions: returns the part with the "reportExtensions.json" file path
- Version: returns the part with the "version.json" file path
- Pages: returns a list of all parts with "*.page.json" file paths
- AllVisuals: returns a list of all parts with "*.visual.json" file paths
- Visuals: returns a list of parts with "*.visual.json" file paths in the context of the rule's own "part" iterator.
- AllBookmarks: returns a list of all parts with "*.bookmark.json" file paths.
- Bookmarks: returns a list of parts with "*.bookmark.json" file paths in the context of the rule's own "part" iterator.
See below for an example using the "Visuals" part operator within the rule's test definition. The part operator in this example returns visual definitions for each page as an array.
{
"id": "DISABLE_DROP_SHADOWS_ON_VISUALS",
"name": "Disable drop shadows on visuals",
"description": "Drop shadows are not suitable for everyone, this rule returns an array of visuals with drop shadows enabled.",
"part": "Pages",
"test": [
{
"map": [
{
"filter": [
{
"part": "Visuals"
},
{
"some": [
{
"var": "visual.visualContainerObjects.dropShadow"
},
{
"==": [
{ "var": "properties.show.expr.Literal.Value" },
"true"
]
}
]
}
]
},
{
"var": "name"
}
]
},
{},
[]
]
}
The path operator provides the ability to define a JSONPath to query the context json. PBI Inspector V2 uses the JsonPath.Net implementation. For details about JSONPath syntax with examples see https://docs.json-everything.net/path/basics/ and https://www.rfc-editor.org/rfc/rfc9535.html.
[documentation in progress]
Accepts a JSON array of rectangle ids, x and y coordinates and width, height and optional margin width. Returns an array of overlapping rectangle ids (inflated by the margin width).
Accepts a search string and regular expression as parameters. Returns the count of regular expression matches in the search string.
Accepts two JSON array parameters, treat them as non-ordered sets, and returns a JSON array representing the symmetric difference of both sets.
Accepts an array of key/value pairs as parameter. Return a JSON record.
Accepts a JSON node as parameter and returns the equivalent stringified JSON.
Accepts two JSON array parameters, treat them as non-ordered sets, and returns a JSON array representing the union of both sets.