Last active
March 8, 2024 17:34
-
-
Save mrupperman/8a0761bbb416b8ef1ca4f51c228f63bf to your computer and use it in GitHub Desktop.
Niagara Sample BQL Queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Example for BQL queries w/ a colon in the slot name
// 1. '$3a' is the colon encoded for the slot
// 2. '$24' is the '$' of $3a' encoded again for the BQL query
public static final String EncodedColon = "$243a";
Example for existence of slot n:history
station:|slot:/Drivers|bql:select * from control:NumericPoint where slotExists('n$243ahistory')
@sammaniamsam I am trying to use the program service to find all points that have a slot named "emergencyActive", your query works if I just do a bql query using ctrl+L but I cannot get it to work in the program service. I cannot figure out how to get the ( ) around the slot name using the program service.
Has anybody in here figured out a way to limit the number of results returned or even better limit and set an offset for paginating the results? I've tried adding limit
and count
to the BQL query without success. Any suggestions or help would be greatly appreciated.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to indicate whether a number in the result of a BQL expression exceeds some value?
I'd like to know if any Zone temperature of approx. 350 VAV's exceeds 72.
My BQL is station:|slot:/|bql:select * from control:ControlPoint where parent.displayName like '-1A-' and displayName like '*ZN-T' and out.value > '72'.
I just can't figure out how to use the result to give me a true or false.
Also, is there a way to display the maximum number of the same query? TIA