Axon Queries and How to

Axon Queries and How to

Examples and How To write Axon queries

Name

Axon query

Description

Name

Axon query

Description

Find Unused Bacnet Connectors

readAll(bacnetConn).findAll(x=> readCount(point and bacnetConnRef==x->id)==0)

Finds all bacnet connectors that are not being used

Contains Search

Examples:

readAll(point).findAll point => point.dis.contains("Temp")

readAll(equip).findAll equip => equip.dis.contains("Vav")

looks for records that 'contain' the text specified in the 'contains' query

Take point descriptions from the Connector and copy it onto a property tag on the point in FIN Stack.

readAll(point and bacnetConnRef).each x=> x.diff({description:bacnetReadObjectProperty(x->bacnetConnRef,x->id,"description").colToList("value").toStr}).commit()

This query takes every point coming from a bacnet connector and adds a string property tag called description and fills in the value of this tag with the description inside the BACnet device.

priority for points

read(writable).pointWriteArray

This will show you what level, and who wrote to a certain priority for points.

create records via commit

commit(diff(null, {dis:"actions testing",actions:"",finActions}, {add}))

This will allow the user to add a new record to the dataBase with a dis tag, action string, and a finActions

marker

add / edit tags on records

readAll(jason).toRecList.map(r => diff(r, {numberTest:88})).commit

This will let you find a list of records that match the filter (Jason), and it will add the numberTest:88

tag to them. Or it will edit the tag if it already exists.

Commit Records from Trio or just a grid

ioReadTrio(`io/finCommunity.trio`).toRecList.map(r => diff(null, r,{add})).commit



remove tags

readAll(jason).toRecList.map(r => diff(r, {numberTest:99,stringTest:"test Me",-rochelle})).commit

-rochelle will find and remove all the rochelle tags, that have a jason marker

delete/remove recrods

readAll(jason).toRecList.map(r => diff(r, null,{remove})).commit

Finds all records that have the jason marker, and will remove them out of the dataBase.

keep Cols

funcs().keepCols(["name","lib","id"])

This takes a grid, in this example I just used the funcs function, and then only kept columns name,lib, and ID

readAll then Fold

readAll(point and unit=="%").foldCol("curVal",avg)

This finds all points, that are %, and it gives you the average for the curVal tag. Using the foldCol function.

foldCols

readAll(point and unit=="%").keepCols(["id","curVal","hisSize"]).foldCols(["curVal","hisSize"],"newCol",sum)

This finds all point and unit, and then keeps just the id, curVal, and hisSize columns. Then it uses a foldCols function, and

sums the curVal, and hisSize columns.

uriPath

`http://host:81/a/b/file.txt`.uriPath

Takes a URI, and breaks out the path into a number of rows

get date info

now().format("MMM")

This query gets the current time, and then formats it so it's Month.

Time Formats

format(today()-9mo, "MMMM") This will show you what 9 months ago today was, and show you the Month only

YY Two digit year 07 YYYY Four digit year 2007 M One/two digit month 6, 11 MM Two digit month 06, 11 MMM Three letter abbr month Jun, Nov MMMM Full month June, November D One/two digit day 5, 28 DD Two digit day 05, 28 DDD Day with suffix 1st, 2nd, 3rd, 24th WWW Three letter abbr weekday Tue WWWW Full weekday Tuesday

find all discover sessions, or find the devices that were previsouly discovered

finDiscoveryRef==@1da849e8-612c4a16 finDiscovery



start from a gird

[{dis:"Site-A", area:2300ft²},     {dis:"Site-B", area:3100ft²},     {dis:"Site-C", area:1950ft²}].toGrid

Take a grid, and start working with it