cfxdm - dm:filter
Data filtering using CFX query language
Last updated
Data filtering using CFX query language
Last updated
dm:filter: This cfxdm tag allows the user to apply simple to complex filters on the retrieved data from a different extension / datasource using CFX query language.
This tag is useful when an extension / datasource does not support filtering the data at the source using cfx query language. So, the pre-requisite is to retrieve the data before using this (dm:filter) tag.
dm:filter syntax:
dm:filter <cfx-ql-query> : Use CFX query language to apply the filter. If you do not want to apply any query and to include all of the ingested data, use '*' (without any quotes).
dm:filter <cfx-ql-query> get COLUMN_Name_1, COLUMN_Name_2, COLUMN_Name_3 .... : Use this syntax to limit the scope to only the selected columns. It also maintains the selected column's specified order.
dm:filter <cfx-ql-query> get COLUMN_Name_1 as 'New_COLUMN_Name_1', COLUMN_Name_2 as 'New_COLUMN_Name_2', COLUMN_Name_3 as 'New_COLUMN_Name_3'... : Use this syntax to limit the scope to only the selected columns and rename them with new column names. It also maintains the selected column's specified order.
Please refer CFX query language section for detailed information on supported queries and their usage/syntax with examples.
In the below example, for reference, we are going to use VMware vROps as an extension to query the data and ingest it into dm:filter tag for applying the filtering capabilities using CFX query language.
Enter the below command to select VMware vROps resources tag (@vrops:resources). (In this example, vrops name is used as a label to identify VMware vROps extension and it's tags. The label is defined while adding the extension in cfxdx configuration file or through UI.)
Example 1:
Get the data from VMware vROps resources tag (@vrops:resources) and modify the column names. Below shown columns (highlighted) are from vROps resource tag.
identifier as Virtual_Resource_Identifier
name as Virtual_Resource_Name
resource_kind as Virtual_Resource_Type
adapter_kind as Virtual_Adapter_Type
--> symbol represents piping the data between two extension tags, the output of an extension tag becomes as an input to another extension tag. It is similar to using the pipe (I) command in Unix/Linux OS.
Example 2:
Get the data from VMware vROps resources tag (@vrops:resources) and filter the data only to selective columns. Below shown (highlighted) are all of the columns from vROps resource tag. Out of them, limit the column selection in a specific order (ex: name, resource_kind & identifier.... skip adapter_kind)
identifier
name
resource_kind
adapter_kind (skip this column from the query)
Example 3:
Get the data from VMware vROps resources tag (@vrops:resources) and using CFX query language, filter the data that matches 'VirtualMachine' under column 'resource_kind' and limit the column's scope only to name, resource_kind & identifier.
Example 4:
Get the data from VMware vROps resources tag (@vrops:resources) and using CFX query language, filter the data that matches 'VirtualMachine' or 'DistributedVirtualPortgroup' or 'ResourcePool' and include all of the available columns.
If the column name has any special character (ex: a dot or dash etc..), then it needs to be escaped with backquotes. For example, the column name is first.name, it should be specified as `first.name` (backquote escape)
ServiceNow Examples:
In this section, we are going to use ServiceNow as an extension to query the data and ingest it into the dm:filter tag for applying the filtering capabilities using CFX query language.
Note: In order for the following examples to work, the main pre-requisite is to add your ServiceNow account details to CFXDX using the CFXDX configuration section.
Example 1:
Checking the connectivity to the ServiceNow instance via CFXDX.
Example 2:
Following ServiceNow tags are available via CFXDX.
Example 3:
Get the data from the ServiceNow tag (#snow:incidents) and modify the column names. Below shown columns (highlighted) are from the ServiceNow incidents tag.
number
short_description
state
priority
Example 4:
Get the data from ServiceNow tag (#snow:incidents)) and using CFX query language, filter the data that matches 'email' under column 'short_description' and limit the column's scope only to Number, Short description. State.
Example 5:
Get the data from ServiceNow tag (#snow:incidents)) and using CFX query language, filter the data that matches 'email' or 'laptop' or 'VPN' under column 'short_description' and limit the column's scope only to Number, Short description. State.