Archive

Archive for the ‘Niagara’ Category

AX Program Object: Trend Analyzer

February 12th, 2009

I’ll be posting various AX program objects and modules all fully commented and free to use how you wish.  This program object calculates the min, max, average, sum, and number of records for a selected history and time range.  The code shows how to run a BQL query programmatically and demonstrates a history rollup.

Property sheet of Trend Analyzer

Property sheet of Trend Analyzer

Read more…

  • Share/Save/Bookmark

Tucker Niagara , , , ,

BQL Query to array of BObjects

February 10th, 2009

Sometimes the batch editor doesn’t cut it and I’m required to write a program to interact with a certain type of component. I could write a robot to traverse through the nav tree but I usually use a BQL query to do the work. The following is a method I often use to grab an Array of BObjects for a given BQL query.

public BObject[] getObjectsFromBql(String bqlString)
{   
   BOrd curOrd;
 
   // Grab reference to local station
   BStation station = (BStation) BOrd.make("station:|slot:/").get();
 
   // Run the BQL query and get the resulting table
   BITable result = (BITable) BOrd.make(bqlString).get(station);
 
   ColumnList columns = result.getColumns();
 
   // Note we're assuming column 0 is "slotPath"     
   Column slotPathColumn = columns.get(0);
   TableCursor c = (TableCursor) result.cursor();
 
   // Create the Array of BObjects to return
   BObject[] objs = new BObject[result.size()];
 
   int i = 0;
   while (c.next())
   {      
      curOrd = BOrd.make(c.get(slotPathColumn).toString());
 
      // Resolve each ord to a BObject, store in our Array
      objs[i++] = (BObject)curOrd.resolve(station).get();
   }
 
   return objs;   
}

Example to get an Array of all BStatusNumerics in ‘fault’:


getObjectsFromBql("select slotPath from baja:StatusNumeric where status.isFault")

Note: You must specify ’slotPath’ as the first column in the query

  • Share/Save/Bookmark

Tucker Niagara ,

BQL Demystified - Part II

February 7th, 2009

One of the most powerful but underutilized features of Niagara AX is BQL queries. John Sublett wrote an excellent post on Niagara-Central called BQL Demystified - Part I that covers basic syntax and meaning. This post will extend John’s post by demonstrating the Query Builder, running custom queries, and other examples.

The example we’re going to try is how to view the name of all Numeric Points whose name starts with “SpaceTemp”. Open the Query Builder (File>Open>Query Builder) and configure it as shown below.

Example of input data for a Niagara AX BQL Query

Example of input data for a Niagara AX BQL Query

After pressing OK you’ll get a table wtih the resulting query.  To view the generated query, hold CTRL and press L (this shows your current ORD).  You should see somethign similar to this:

station:|slot:/|bql:select navOrd from control:NumericPoint where name = 'SpaceTemp'

The cool part is that you can write and run your own query by copying it into the Open Ord dialog (CTRL+L).

More Examples:

View all Numeric Points whose name contains the word “Outside”:

station:|slot:/|bql:select * from control:NumericPoint where name like '*Outside*'

View the ord of all Numeric Points that are > 85:

station:|slot:/|bql:select slotPath from control:NumericPoint where out.value > 85.0

View the name and ord of all Control Points whose status is not OK:

station:|slot:/|bql:select navName,ord from control:ControlPoint where !status.isOk

  • Share/Save/Bookmark

Tucker Niagara , ,

Hello world!

January 4th, 2009

My name is Tucker Watson and I’m a software developer for Activelogix located in Charlotte, NC.  I graduated from Clemson University in May 2008 with a degree in Computer Science and have since been working on a Flex project to allow end-users to manage and monitor their facilities.

I was introduced to the HVAC world in 2005 while interning at Tridium.  I was a software tester for two summers and spent one as a software developer.  This blog will mostly revolve around Niagara AX and Flex development.

  • Share/Save/Bookmark

Tucker Flex, Niagara, Periscope , , , , , , ,