Skip to content

Instantly share code, notes, and snippets.

@mrupperman
Last active September 9, 2025 16:04
Show Gist options
  • Save mrupperman/8a0761bbb416b8ef1ca4f51c228f63bf to your computer and use it in GitHub Desktop.
Save mrupperman/8a0761bbb416b8ef1ca4f51c228f63bf to your computer and use it in GitHub Desktop.
Niagara Sample BQL Queries
Alarm Queries
local:|fox:|station:|slot:/|bql:select name as 'Point Name',out as 'Point Status' from control:ControlPoint where status.alarm = 'true'
local:|fox:|station:|slot:/|bql:select * from alarm:AlarmSourceExt where alarmClass = 'defaultAlarmClass' and status.alarm = true
alarm:|bql:select timestamp,alarmData.sourceName,sourceState,ackState,ackRequired,alarmData.msgText,alarmClass where alarmData.sourceName like 'B1J*' and alarmClass like '*1*' order by timestamp desc
alarm:|bql:select timestamp,alarmData.sourceName,sourceState,ackState,ackRequired,alarmData.msgText,alarmClass where alarmData.sourceName like 'B1J*' and alarmClass like '*2*' order by timestamp desc
alarm:|bql:select *
History Queries
local:|fox:|history:/MyStation/ZoneTemp|bql:select timestamp, value where timestamp in bqltime.today
history:|bql:select *
Component Queries
local:|fox:|station:|slot:/VAV_Bldg_1|bql:select slotPath as 'Path', displayName as 'Display', out.value as 'Output Value' from control:NumericPoint where displayName like '*ZN_T*'
local:|fox:|station:|slot:/VAV_Bldg_1|bql:select slotPath as 'Path', displayName as 'Display', out.value as 'Output Value' from control:NumericPoint where displayName like '*ZN_T*' or displayName like '*STPT*'
local:|fox:|station:|slot:/Exercises|bql:select * where slotPath like '*TrafficLight1'
Http Queries - Must be using Basic Hx Profile
http://192.168.7.194/ord?station:|alarm:/|bql:select%20*
http://192.168.7.194/ord?station:|alarm:/|bql:select%20timestamp,%20source%20where%20source%20like%20%27*Temperature*%27
http://192.168.7.194/ord?station:|history:/SqlDemo|bql:select%20*
http://192.168.7.194/ord?station:|history:/SqlDemo/ZoneTemperature|bql:select%20*
http://192.168.7.194/ord?station:|history:/SqlDemo/ZoneTemperature|bql:select%20status,%20value%20where%20timestamp%20in%20bqltime.lastweek (for this you can also use bqltime.lastmonth, bqltime.last7days, etc)
http://192.168.7.194/ord?station:|history:/SqlDemo/ZoneTemperature?period=timeRange;start=2016-04-05T00:00:00.000-00:00;end=2016-04-17T00:00:00.000-00:00|bql:select%20status,%20value,%20timestamp
http://192.168.7.194/ord?station:|history:/SqlDemo/AuditHistory|bql:select%20*
http://192.168.7.194/ord?station:|slot:/|bql:select%20name,out.value%20as%20%27Absolute%20Ord%27%20from%20control:NumericPoint
@robheathcock
Copy link

robheathcock commented Jan 19, 2025

Hi Adam

This is an example of a BQL query utilising NEQL.

station:|slot:|neql:n:point|bql:select displayName, slothPathOrd

station:|slot:|neql:hs:site|bql:select count(out)

@SrGarcia5
Copy link

Hi, rob Heathcock

First-. This is an example of BQL query to display value of equipments in active mode, but when all equipments are in Inactive mode the value desapear, can you help to add any script to send 0 if I have not objects available?

station:|slot:/Drivers/BuildingNetwork/FirstFloor|bql:select COUNT(out) from control:BooleanPoint where name like 'Fan$20Monitoring' or name like 'BI_status_fan' and valueWithFacets like 'Active'|cell:0,0

Second-.
This is an example of BQL query to display AVG value, how can I use the value in the wiresheet and convert to control point?

station:|slot:/Drivers/BuildingNetwork/FirstFloor|bql:select AVG(out) from control:NumericPoint where name like 'Room' or name like 'AV_space_temp'|cell:0,0

picture Example
FFloor

@travellingmonk
Copy link

Hi all,

I have a big site with more than 200 alarm Class. I am trying to find what points/component fall under each alarm class. I am trying to using program service, but no luck. Probably i am doing something wrong. using Niagara wb 4.11

@amolgadadr
Copy link

In Niagara station
Follow below path:

station:|slot:/Services/AlarmService|view:alarm:AlarmExtManager

This will give you the summary of all alarms in the site along with it's associated alarm classes.

You can export it in csv also.

@travellingmonk
Copy link

travellingmonk commented Feb 26, 2025

Ah! Thank you @amolgadadr

@amolgadadr
Copy link

Please see below image.
image

@travellingmonk
Copy link

@amolgadadr yes! i saw it later on :) Thank you!

@goseese
Copy link

goseese commented Aug 9, 2025

I wonder if you have any experience or pointers for a query I am trying to figure out.

Given I have a Jace8000 and I can execute this query to see all points on the controller.

/ord?station:|slot:/Drivers/NrioNetwork|bql:select%20*%20from%20control:ControlPoint

Returns a lis something like this. I cut out a lot of content and some of the columns to shorten this up.

slot:/Drivers/NrioNetwork/IO$2dR$2d34/points/DigitalInputs/SysA1DoorSwitch Open {down,stale}
slot:/Drivers/NrioNetwork/IO$2dR$2d34/points/DigitalInputs/SysA6DoorSwitch Open {down,stale}
slot:/Drivers/NrioNetwork/IO$2dR$2d16$2d1/points/SysA1Temp 302.0 °F {down,stale} units=°F,precision=1,min=-inf,max=+inf
slot:/Drivers/NrioNetwork/IO$2dR$2d16$2d1/points/SysA4TempA 302.0 °F {down,stale} units=°F,precision=1,min=-inf,max=+inf
...
slot:/Drivers/NrioNetwork/IO$2dR$2d16$2d1/points/Comp$233_Med_Temp_Alarm
slot:/Drivers/NrioNetwork/IO$2dR$2d16$2d1/points/SysA1Defrost Defrost Off {down,unackedAlarm} @ 16
slot:/Drivers/NrioNetwork/IO$2dR$2d16$2d1/points/SysA5TempB 302.0 °F {down,stale}

My question is this.

On this jace in the web interface there is a [ Refrigeration ] and [HVAC] tab.
Clicking on those shows there are refrigeration systems called
System A1
System A2
....
System A6

Is there a query that I can execute to show me all refrigeration systems by name, or somehow get the config for the .px page?

Secondly, is there a way I can execute a contorl:ControPoint query as in above but only return controlPoints that have been associated/reated to for example SysA1. a door sensor or compressor might not have SysA1 in it's point name but it is showing as a part of that refrigeration system in the jace web UI.

@travellingmonk
Copy link

Hi all,

I have a big site with more than 200 alarm Class. I am trying to find what points/component fall under each alarm class. I am trying to using program service, but no luck. Probably i am doing something wrong. using Niagara wb 4.11

So, here’s what’s happening: I have two drivers/networks running on my Niagara station—one for Tridium controllers and another for EcoStruxure. The issue is that the EcoStruxure devices are actual physical points, and I can see them in the AlarmExtManager. In other words, I can see exactly which point is linked to which alarm class.

However, the Niagara points are all virtual points. They have alarms configured, and everything is mapped into an alarm class. I have 50+ Niagara controllers, and all of them use virtual points. Each controller has a console recipient, and each recipient contains 4 alarm classes.

The problem is: I cannot see these classes in the AlarmExtManager, even though I can see them on the wiresheet, and when I open the console recipient, I can see the alarms there.

My question is: Is this happening because the points are virtual, and therefore they don’t show up in the AlarmExtManager?

@AdBaker97
Copy link

AdBaker97 commented Sep 9, 2025

Hi All,

Does if you can query to find a value in a tag for all points.

For example, creating a data table for all points in a certain device, but pulling the n:ordInSession Tag from each of them to display in the table.

Could have swore i've seen syntax like - bql select getTag(n:ordInSession) as 'Ord in Session' - but can't get it to work. Maybe I dreamt it. Or maybe this only works for direct tags?

@robheathcock
Copy link

robheathcock commented Sep 9, 2025

Hey @AdBaker97

This might be a starting point:

station:|slot:|neql:n:ordInSession|bql:select displayName, ordInSession

A bit more refined to target a specifc slot path rather than the whole Station:

station:|slot:/Folder|neql:n:ordInSession|bql:select displayName, ordInSession, ord

@robheathcock
Copy link

robheathcock commented Sep 9, 2025

@goseese

I wonder if you have any experience or pointers for a query I am trying to figure out.

Given I have a Jace8000 and I can execute this query to see all points on the controller.

/ord?station:|slot:/Drivers/NrioNetwork|bql:select%20*%20from%20control:ControlPoint

Returns a lis something like this. I cut out a lot of content and some of the columns to shorten this up.

slot:/Drivers/NrioNetwork/IO$2dR$2d34/points/DigitalInputs/SysA1DoorSwitch Open {down,stale} slot:/Drivers/NrioNetwork/IO$2dR$2d34/points/DigitalInputs/SysA6DoorSwitch Open {down,stale} slot:/Drivers/NrioNetwork/IO$2dR$2d16$2d1/points/SysA1Temp 302.0 °F {down,stale} units=°F,precision=1,min=-inf,max=+inf slot:/Drivers/NrioNetwork/IO$2dR$2d16$2d1/points/SysA4TempA 302.0 °F {down,stale} units=°F,precision=1,min=-inf,max=+inf ... slot:/Drivers/NrioNetwork/IO$2dR$2d16$2d1/points/Comp$233_Med_Temp_Alarm slot:/Drivers/NrioNetwork/IO$2dR$2d16$2d1/points/SysA1Defrost Defrost Off {down,unackedAlarm} @ 16 slot:/Drivers/NrioNetwork/IO$2dR$2d16$2d1/points/SysA5TempB 302.0 °F {down,stale}

My question is this.

On this jace in the web interface there is a [ Refrigeration ] and [HVAC] tab. Clicking on those shows there are refrigeration systems called System A1 System A2 .... System A6

Is there a query that I can execute to show me all refrigeration systems by name, or somehow get the config for the .px page?

Secondly, is there a way I can execute a contorl:ControPoint query as in above but only return controlPoints that have been associated/reated to for example SysA1. a door sensor or compressor might not have SysA1 in it's point name but it is showing as a part of that refrigeration system in the jace web UI.

Hi

This might be a starting point:

station:|slot:/VAV_Bldg_1|bql:select slotPath as 'Path', displayName as 'Display', out.value as 'Output Value' from control:NumericPoint where displayName like 'ZN_T' or displayName like 'STPT'

I think you would be able to change displayName like 'STPT' to something more specific such as parent.parent.displayName = 'System A1'.
They can then be conditioned to look for multiple specific matches.

station:|slot:/VAV_Bldg_1|bql:select slotPath as 'Path', displayName as 'Display', out.value as 'Output Value' from control:NumericPoint where parent.parent.displayName = 'System A1' or parent.parent.displayName = 'System A2'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment