NQL as()
The as()
function allows you to display the output from NQL queries in a formatted manner by assigning specific formatting information to the metrics. The Nexthink interface displays the data with the unit specified. The as()
function is supported in the list and sort clauses.
Example:
devices
| summarize total_cost = count() * 2000
| list total_cost.as(format = currency, code = USD)

Use the following formatting options:
Formatter
Unit
Example query
energy
Wh
kWh
MWh
GWh
device_performance.events during past 1d
| where device.operating_system.platform = macos
| where hardware.type == laptop
| summarize estimated_energy = ((8 * 0.070) * device.count())
| list estimated_energy.as( format = energy )
weight
g
kg
t
kt
devices
| where hardware.type = laptop or hardware.type = desktop
| summarize no_of_devices = (count()^1) * 422.5
| list no_of_devices.as( format = weight )
currency
Specify the currency using the additional code
parameter.
CAD
: CA$
CHF
: CHF
GBP
: £
EUR
: €
USD
: $
devices
| summarize total_cost = count() * 2000
| list total_cost.as(format = currency, code = USD)
devices
| summarize total_cost = count() * 2000
| list total_cost.as(format = currency, code = EUR)
percent
% To compute the percentage, the system multiplies the value by 100 and appends the % symbol. For example, a value of 0.47 is converted to 47%.
devices
| with execution.crashes
| summarize impacted_devices = countif(operating_system.name == "Windows 10 Pro 22H2 (66 bits)")/count()
| list impacted_devices.as(format = percent)
bitrate
bps
Kbps
Mbps
Gbps
connectivity.events during past 30d
| where primary_physical_adapter.type == wifi
| where wifi.signal_strength.avg <= -67 or (context.device_platform == "macOD" and wifi.noise_level.avg >= -80)
| summarize average_receive_rate = wifi.receive_rate.avg()
| list average_receive_rate.as(format = bitrate)
Last updated
Was this helpful?