User Manual

Table Of Contents
Advanced functionality
Creating a button to command multiple data points
7
186 | 195
A6V11604297_en--_g
Command
Description
Program code to paste into the first line of
the PROGRAM EDITOR
Command multiple data points
Note
This general example does not work for
points with a Priority Array and uses a
very generic example query. See the
collection of other examples to adapt the
query and commanding syntax to
specific needs.
readALL() searches the entire database and
returns all records that match the query
parameter. This example queries for any
numeric writable data points. Replace this
query as desired to find the points to be
commanded. Refer to the section on binding
for additional information on using tag
queries (for example., fixed baUniqueId
query or Relative tag query).
.getSafe(0..n) selects a number of records
from the total number of records returned by
readAll().
In this example, if fewer than three
items are found, they are safely
enumerated, avoiding any indexing
errors.
If more than ten items are found, the
first three found are enumerated. (This
selection is random.)
If only one unique point is expected to be
found by the query, consider replacing
readAll() with read() using the syntax shown
by other examples in this table.
baPointCommand() is executed once for
each point selected by getSafe(0..n).
The x parameter in baPointCommand() is
replaced with a selected point.
The $1 parameter in baPointCommand() is
replaced with the value assigned to the
writeVal property tag belonging to the
specific button that invoked the program.
finstack.eval(sprintf('readAll(sh
adowPoint and writable and
kind=="Number").getSafe(0..2).map
(x=> x-
>pointRef.readById).colToList("id
").each x=>
baPointCommand(x,$1)',this.writeV
al));
Set a specific point out of service
read() searches the entire database and
returns just one record (the first match).
The parameter to read() is a query for
exactly one item matching the unique id of
the point.
finstack.eval('read(baUniqueId ==
"3847e44de9331bb8e7526e98b4d3cf15
be67be87")-
>pointRef.baPointCmdOutOfService(
true)');
Command a specific point (without a
Priority)
read() searches the entire database and
returns just one record (the first match).
The parameter to read() is a query for
exactly one item matching the unique id of
the point.
finstack.eval('read(baUniqueId ==
"3847e44de9331bb8e7526e98b4d3cf15
be67be87")-
>pointRef.baPointCommand(44)');
Put a specific point back into service
read() searches the entire database and
returns just one record (the first match).
The parameter to read() is a query for
exactly one item matching the unique id of
the point.
finstack.eval('read(baUniqueId ==
"3847e44de9331bb8e7526e98b4d3cf15
be67be87")-
>pointRef.baPointPutInService()')
;
Override (Priority 8) one specific point
read() searches the entire database and
returns just one record (the first match).
The parameter to read() is a query for
exactly one item matching the unique id of
the point.
finstack.eval('read(baUniqueId ==
"3847e44de9331bb8e7526e98b4d3cf15
be67be87")-
>pointRef.baPointOverride(13)');
Release (Priority 8) one specific point
read() searches the entire database and
returns just one record (the first match).
The parameter to read() is a query for
exactly one item matching the unique id of
the point.
finstack.eval('read(baUniqueId ==
"3847e44de9331bb8e7526e98b4d3cf15
be67be87")-
>pointRef.baPointRelease()');