Funcs
Funcs : Funcs
Map a set of recs to to a grid of sites
Map a set of recs to to a grid of spaces
Map a set of recs to to a grid of equips
Map a set of recs to to a grid of devices
Map a set of recs to to a grid of points
Given a site, space, equip, or point rec, get its occupied point
Given a equip record Dict, return a grid of its points
User level-1 manual override of writable point
User level-1 manual auto (override release) of writable point
User level-8 manual override of writable point
User level-8 manual auto (override release) of writable point
Set the relinquish default value (level-17) of writable point
Set a writable point's priority array value at the given level
Issue a point override command based on current user's access control permissions
Return the current priority array state of a writable point
Evaluate a point conversion
Get debug string for point including writables and his collection
Return grid of thermistor table names as grid with one name column
Return grid of current enum defs defined by enumMeta
Return definition of given enum def defined by enumMeta
Return if a point value matches a given critera
Write all hisCollect items buffered in memory to the historian
(recs: Obj?) => Grid
Map a set of recs to to a grid of sites. The recs
parameter may be any value accepted by toRecList(). Return empty
grid if no mapping is found. The following mappings are supported:
- recs with
sitetag are mapped as themselves - recs with
siteReftag are mapped to their parent site
Examples:
read(site).toSites // return site itself
read(space).toSites // return space's parent site
read(equip).toSites // return equip's parent site
read(point).toSites // return point's parent site
(recs: Obj?) => Grid
Map a set of recs to to a grid of spaces. The recs
parameter may be any value accepted by toRecList(). Return empty
grid if no mapping is found. The following mappings are supported:
- recs with
spacetag are mapped as themselves - recs with
spaceReftag are mapped to their parent space - recs with
siteare mapped to spaces with parentsiteRef
Examples:
read(site).toSpaces // return children spaces within site
read(equip).toSpaces // return equip's parent space
read(point).toSpaces // return point's parent space
read(space).toSpaces // return space itself
(recs: Obj?) => Grid
Map a set of recs to to a grid of equips. The recs
parameter may be any value accepted by toRecList(). Return empty
grid if no mapping is found. The following mappings are supported:
- recs with
equiptag are mapped as themselves - recs with
equipReftag are mapped to their parent equip - recs with
siteare mapped to equip with parentsiteRef - recs with
spaceare mapped to equip with parentspaceRef
Examples:
read(site).toEquips // return children equip within site
read(space).toEquips // return children equip within space
read(equip).toEquips // return equip itself
read(point).toEquips // return point's parent equip
(recs: Obj?) => Grid
Map a set of recs to to a grid of devices. The recs
parameter may be any value accepted by toRecList(). Return empty
grid if no mapping is found. The following mappings are supported:
- recs with
devicetag are mapped as themselves - recs with
deviceReftag are mapped to their parent device - recs with
siteare mapped to devices with parentsiteRef - recs with
spaceare mapped to devices with parentspaceRef - recs with
equipare mapped to devices with parentequipRef
Examples:
read(site).toDevices // return children devices within site
read(space).toDevices // return children devices within space
read(equip).toDevices // return children devices within equip
read(point).toDevices // return point's parent device
(recs: Obj?) => Grid
Map a set of recs to to a grid of points. The recs
parameter may be any value accepted by toRecList(). Return empty
grid if no mapping is found. The following mappings are supported:
- recs with
pointtag are mapped as themselves - recs with
siteare mapped to points with parentsiteRef - recs with
spaceare mapped to points with parentspaceRef - recs with
equipare mapped to points with parentequipRef - recs with
deviceare mapped to points with parentdeviceRef
Examples:
read(site).toPoints // return children points within site
read(space).toPoints // return children points within space
read(equip).toPoints // return children points within equip
read(device).toPoints // return children points within device
(rec: Obj?, checked: Bool) => Dict?
Given a site, space, equip, or point rec, get its occupied point. The following algorithm is used to lookup the occupied point:
- Try to find in equip or parent of nested equip
- Try to find in space or parent of nested spaces
- Try to find in site if site if tagged as
sitePoint
If there are no matches or multiple ambiguous matches, then return null or raise an exception based on checked flag.
(equip: Obj) => Grid <overridable>
Given a equip record Dict, return a grid of its points.
If this function is overridden you MUST NOT use an XQuery to
resolve points; this function must return local only points.
(point: Obj, val: Obj?) => Obj? <admin>
User level-1 manual override of writable point. See pointWrite.
(point: Obj) => Obj? <admin>
User level-1 manual auto (override release) of writable point. See pointWrite.
(point: Obj, val: Obj?, duration: Number?) => Obj? <admin>
User level-8 manual override of writable point. If duration is specified it must be a number with unit of time that indicates how long to put the point into override. After the duration expires, the point is set back to auto (null). See pointWrite.
(point: Obj) => Obj? <admin>
User level-8 manual auto (override release) of writable point. See pointWrite.
(point: Obj, val: Obj?) => Obj? <admin>
Set the relinquish default value (level-17) of writable point. See pointWrite.
(point: Obj, val: Obj?, level: Number?, who: Obj?, opts: Dict?) => Obj? <admin>
Set a writable point's priority array value at the given level. The point may be any value accepted by toRec(). Level must be 1 to 17 (where 17 represents def value). The who parameter is a string which represent debugging information about which user or application is writing to this priorirty array level. If who is omitted, then the current user's display string is used
(point: Obj, val: Obj?, level: Number, duration: Number?) => Obj?
Issue a point override command based on current user's access control permissions
(point: Obj) => Grid
Return the current priority array state of a writable point. The point may be any value accepted by toRec(). The result is returned grid with following columns:
- level: number from 1 - 17 (17 is default)
- levelDis: human description of level
- val: current value at level or null
- who: who last controlled the value at this level
(pt: Obj?, convert: Str, val: Obj?) => Obj?
Evaluate a point conversion. First parameter is point to test (anything accepted by toRec()) or null to use empty dict.
Examples:
pointConvert(null, "+ 2 * 10", 3)
pointConvert(null, "hexToNumber()", "ff")
pointConvert(null, "°C => °F", 20°C)
(point: Obj) => Str
Get debug string for point including writables and his collection. The argument is anything acceptable by toRec(). The result is returned as a plain text string.
Examples:
read(dis=="My Point").pointDetails
pointDetails(@2b80f96a-820a4f1a)
() => Grid
Return grid of thermistor table names as grid with one name column
() => Grid
Return grid of current enum defs defined by enumMeta. This call forces a refresh of the definitions.
(id: Str, checked: Bool) => Grid?
Return definition of given enum def defined by enumMeta. This call forces a refresh of the definitions.
(val: Obj?, match: Obj?) => Bool
Return if a point value matches a given critera:
- match any values which are equal via
==operator - zero matches false (0% ==> false)
- non-zero matches true (not 0% ==> true)
- numerics can be matches with range
- match can be a function which takes the value
Examples:
matchPointVal(false, false) >> true
matchPointVal(0, false) >> true
matchPointVal(33, false) >> false
matchPointVal(33, true) >> true
matchPointVal(33, 0..40) >> true
matchPointVal(90, 0..40) >> false
matchPointVal(4) x => x.isEven >> true
(timeout: Number?) => Obj? <admin>
Write all hisCollect items buffered in memory to the historian. Block until complete or until timeout exceeded.