Commits modified values to database. NOTES: 1. Data commit is allowed only for authorized and authenticated users using a secure connection. 2. When Windows Authentication is used as the web authentication method, users that belong to the BUILTIN/Administrators group are not treated as members of the group unless they are running the browser with elevation (Run as administrator).3. Class instance specific permissions for the current user can be fetched using the '$ACR' special property with FetchClassData.
Name of class, which data to update.
List of properties to update, prefix with RAW: to update raw values.
(System.Object[]) List of instance id's to be updated (to get them, get RAW:Id when fetching class data).
(System.Object[]) List of new values. If committing multiple instances, the list size should be multiple of properties.length. When given as null the instances are deleted.
(System.Object[]) List of old values or null. If committing multiple instances, the list size should be multiple of properties.length. Old values are used to check prevent conflicting changes (occuring for example when two users want to increase value by one at the same time).
Optionalcallback: TCallback<TCommitClassDataResult>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
//Example callback handlers
const commitcallback=(ret)=>
{//return callback for the commit - exceptions for individual instances returned as string, committed values returned in an array
for(let i=0;i<ret.length;i++)
{
if(typeof ret[i]==="string") console.log("Commit for instance "+(i+1)+" failed:", ret[i]);
else if(typeof ret[i]==="array") console.log("Commit for instance "+(i+1)+" succeeded:", ret[i]);
else if(ret[i]= is null) console.log("Commit for instance "+(i+1)+" succeeded, Class does not support return values.");
}
};
const commitexception=(ex)=>
{//general commit failure exception handler (NOTE: commit exceptions for individual instances returned in the normal callback!)
console.log("Commit operation failed: ", ex);
};
const c=GetConnection();
//Insert 2 new class instances
c.CommitClassData(
"MyClass", //class name
["Property1", "Property2"], //properties to commit
[null, null], //class instance ids (should be null when inserting new instances)
[
[inst1p1value, inst1p2value], //Property values for the first instance
[inst2p1value, inst2p2value] //Property values for the second instance
],
null, //old values (should be null when inserting new instances)
commitcallback,
commitexception
);
//Update 2 class instances
c.CommitClassData(
"MyClass", //class name
["Property1", "Property2"], //properties to update
[id1, id2], //class instance ids
[
[inst1p1newvalue, inst1p2newvalue], //New property values for the first instance
[inst2p1newvalue, inst2p2newvalue] //New property values for the second instance
],
[//Old values - (if not null) checked so that commit for the instance fails if the existing values differ from these
[inst1p1value, inst1p2value], //Old property values for the first instance
[inst2p1value, inst2p2value] //Old property values for the second instance
],
commitcallback,
commitexception
);
//Delete 2 class instances
c.CommitClassData(
"MyClass", //class name
[], //properties array should be empty
[id1, id2], //class instance ids
null, //New values as null - means that the instances are deleted
[//Old values - (if not null) checked so that delete for the instance fails if the existing values differ from these
[inst1p1value, inst1p2value], //Old property values for the first instance
[inst2p1value, inst2p2value] //Old property values for the second instance
],
commitcallback,
commitexception
);
Inserts/Modifies/Removes rows into a history table.
(System.Object[]) The timestamps of updates values.
(System.Object[]) Updates values; Set to null for rows that need to be removed.
(System.UInt64[]) Statuses of updates values.
Class to fetch data from, for example use "ProcessHistory" to access normal RTDB histories.
Property to provide values for X-axis, for example use "Time" together with "ProcessHistory".
Property to provide values for Y-axis, for example use "Value" together with "ProcessHistory".
Message that will be written to the HistoryUpdateLog, leave empty if not required.
The filtering mask for the fetch; If some rows are to be deleted, the time range must be specified.
(System.Object[]) Arguments to be used in place of possible ?-chars within the wherestring.
Optionalcallback: TCallback<boolean>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Returns only when client has received all the events that have been triggered so far. Do not use unless you are sure you know what you are doing.
Optionalcallback: TCallback<boolean>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Executes a class bound command by name if driver defines one with security checking. The ExecuteClassBoundCommand call should be redirected to this routine by wrapper drivers that want to apply security checking.
Class name to perform the command on.
Name of the command to execute.
Command parameters.
(System.Object[]) Array of instance ids targetted by the command.
Optionalcallback: TCallback<unknown>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
(Server type: System.Object)
Fetches values for selected properties of class instances filtered by wherestr -argument. For list of classes, try querying with classname "Class", for list of class properties, try querying with classname "ClassProperty".
Name of the class, which values should be fetched.
List of properties to be fetched. Prefix property name with RAW: to get raw value instead of a pre-formatted value. Use null to get raw values of all properties as objects. Use $ACR to get permissions for accessing the instance. Use $REF to get an object reference string representing the instance. Prefix property name with VISIBLE: to get current visibility as boolean (true/false) determined by VisibilityRequirement property attribute.
(System.Int32) Maximum number of rows to fetch, use -1 for unlimited.
The where mask for the fetch.
A where mask is a clause specifying a criteria for the fetch. Only instances that meet the criteria are included in the result set. The criteria consists of predicates using class properties (defined in ClassProperty class), operators and comparison values.
An example: "Name LIKE 'SYS*' AND (Type = 1 OR Type = 3)"
(Include instances whose Name starts with the string 'SYS' and whose Type is either 1 or 3.)
The syntax resembles SQL, but is not SQL. The supported operators are =, !=, >, >=, < and <=. AND, OR, LIKE, IN, IS and ORDER BY are supported however IS is used for type checking, not for null checks (eg. Unit IS System.Int32) - null checks are done by just using null like any other value (eg. Unit=null). Wildcards for LIKE are * and ?. SQL injection attacks will not work as this is not SQL.
(System.Object[]) Arguments to be used in place of possible ?-chars within where string.
Optionalcallback: TCallback<TFetchClassDataResult>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
connection.FetchClassData(
"ClassProperty",
["Name", "Type"],
-1,
"ClassName LIKE ? AND IsNullable=? ORDER BY Name",
["Class", false],
(r)=>
{
for(let i=0;i<r.Data.length;i+=2)
{// Loop through the rows
console.log(i/2 + ": " + r.Data[i] + ", " + r.Data[i+1]);
}
},
(msg)=>{window.alert(msg);}
);
Fetches class instances filtered by wherestring -argument.
Name of the class, which instances should be fetched.
(System.Int32) Maximum number of instances to fetch, use -1 for unlimited.
The where mask for the fetch.
A where mask is a clause specifying a criteria for the fetch. Only instances that meet the criteria are included in the result set. The criteria consists of predicates using class properties (defined in ClassProperty class), operators and comparison values.
An example: "Name LIKE 'SYS*' AND (Type = 1 OR Type = 3)"
(Include instances whose Name starts with the string 'SYS' and whose Type is either 1 or 3.)
The syntax resembles SQL, but is not SQL. The supported operators are =, !=, >, >=, < and <=. AND, OR, LIKE, IN, IS and ORDER BY are supported however IS is used for type checking, not for null checks (eg. Unit IS System.Int32) - null checks are done by just using null like any other value (eg. Unit=null). Wildcards for LIKE are * and ?. SQL injection attacks will not work as this is not SQL.
(System.Object[]) Arguments to be used in place of possible ?-chars within where string.
Optionalcallback: TCallback<TFetchClassInstancesResult>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
connection.FetchClassInstances(
"ClassProperty",
-1,
"ClassName LIKE ? AND IsNullable=? ORDER BY Name",
["Class", false],
function(data)
{
for(let i=0;i<data.length;i++)
{// Loop through the instances
const inst=data[i];
console.log(i + ": " + inst.Name + ", " + inst.Type);
}
},
function(msg) {window.alert(msg);}
);
Fetches information on specified equipment type.
Equipment type
Optionalcallback: TCallback<TFetchEquipmentInfoResult>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Class to fetch data from, use "ProcessHistory" to access normal RTDB histories. Three special classes $MERGE, $STACK and $CALC allow combining the results of previous FetchGraphData queries into one result. Prepending class name with ! tells the server not to send response to this query (userful with $MERGE, $STACK and $CALC).
Property to provide values for X-axis, use "Time" together with "ProcessHistory".
Property to provide values for Y-axis, use "Value" together with "ProcessHistory".
Optional filter to apply on data, eg. AVG1MIN to get one minute averages, see Vtrin documentation for further info on filters.
(System.Int32) Pixels on plot area in X-direction, only used with PLOT/PLOTM filters, otherwise ignored.
(System.Int32) Pixels on plot area in Y-direction, only used with PLOT/PLOTM filters, otherwise ignored.
(System.Int32) Maximum number of values to fetch.
The where mask for the fetch.
A where mask is a clause specifying a criteria for the fetch. Only instances that meet the criteria are included in the result set. The criteria consists of predicates using class properties (defined in ClassProperty class), operators and comparison values.
An example: "Name LIKE 'SYS*' AND (Type = 1 OR Type = 3)"
(Include instances whose Name starts with the string 'SYS' and whose Type is either 1 or 3.)
The syntax resembles SQL, but is not SQL. The supported operators are =, !=, >, >=, < and <=. AND, OR, LIKE, IN, IS and ORDER BY are supported however IS is used for type checking, not for null checks (eg. Unit IS System.Int32) - null checks are done by just using null like any other value (eg. Unit=null). Wildcards for LIKE are * and ?. SQL injection attacks will not work as this is not SQL.
Ignored if class is $MERGE or $STACK. The expression to be evaluated if class is $CALC.(System.Object[]) Arguments to be used in place of possible ?-chars within where string. List of previous call ids to be merged or stacked if class is $MERGE or $STACK. List of variable names and previous calls ids if class is $CALC.
Optionalcallback: TCallback<TGraphData>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Fetches data for trend plotting or similar use. This function might change in future releases as there are plans to change graph fetching to subscription based model.
$MERGE class allows merging multiple histories into one structure with interpolation. Useful for histories combining multiple sources, e.g. position combining both latitude and longitude.
$STACK class allows stacking multiple histories on top of each others, i.e. calculating sum of histories at all points. This is useful when rendering stacked graphs on low-powered devices.
$CALC class allows executing arbitrary mathematical expressions on histories on the server side. This is useful for offloading some heavy computation from client side to server.
All sources for $MERGE, $STACK and $CALC calls must precede the call in same multicall. They must also be either unconsumed (i.e. not returned by prepending class name with !) or restartable. Same source can not be included multiple times, even recursively.
Example of $MERGE:
[[11, 'FetchGraphDataEx', ['ProcessHistory', 'Time', 'Value', '', null, 100, 'Variable=? AND Time>=? AND Time<?', ['Sine Integer8', '2001-01-01 00:00:00', '2001-01-01 00:20:00']]],[12, 'FetchGraphDataEx', ['ProcessHistory', 'Time', 'Value', '', null, 100, 'Variable=? AND Time>=? AND Time<?', ['Sawtooth Integer8', '2001-01-01 00:00:00', '2001-01-01 00:20:00']]], [13, 'FetchGraphDataEx', ['$MERGE', 'Time', 'Value', '', null, 100, '', [11, 12]]]]
$STACK works in similar way.
Example of $CALC:
[[11, 'FetchGraphDataEx', ['ProcessHistory', 'Time', 'Value', '', null, 100, 'Variable=? AND Time>=? AND Time<?', ['Sine Integer8', '2001-01-01 00:00:00', '2001-01-01 00:20:00']]],[12, 'FetchGraphDataEx', ['ProcessHistory', 'Time', 'Value', '', null, 100, 'Variable=? AND Time>=? AND Time<?', ['Sawtooth Integer8', '2001-01-01 00:00:00', '2001-01-01 00:20:00']]], [13, 'FetchGraphDataEx', ['$CALC', 'Time', 'Value', '', 0, 0, 100, 'A+B*A', ['A', 11, 'B', 12]]]]
Class to fetch data from, use "ProcessHistory" to access normal RTDB histories. Three special classes $MERGE, $STACK and $CALC allow combining the results of previous FetchGraphData queries into one result. Prepending class name with ! tells the server not to send response to this query (userful with $MERGE, $STACK and $CALC).
Property to provide values for X-axis, use "Time" together with "ProcessHistory".
Property to provide values for Y-axis, use "Value" together with "ProcessHistory".
(System.Int32) Maximum number of values to fetch.
Optional filter to apply on data, eg. AVG1MIN to get one minute averages, see Vtrin documentation for further info on filters.
(System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]) Base time for aligning filter time periods - ignored when no filter specified or the filter does not produce periodical values
The where mask for the fetch.
A where mask is a clause specifying a criteria for the fetch. Only instances that meet the criteria are included in the result set. The criteria consists of predicates using class properties (defined in ClassProperty class), operators and comparison values.
An example: "Name LIKE 'SYS*' AND (Type = 1 OR Type = 3)"
(Include instances whose Name starts with the string 'SYS' and whose Type is either 1 or 3.)
The syntax resembles SQL, but is not SQL. The supported operators are =, !=, >, >=, < and <=. AND, OR, LIKE, IN, IS and ORDER BY are supported however IS is used for type checking, not for null checks (eg. Unit IS System.Int32) - null checks are done by just using null like any other value (eg. Unit=null). Wildcards for LIKE are * and ?. SQL injection attacks will not work as this is not SQL.
Ignored if class is $MERGE or $STACK. The expression to be evaluated if class is $CALC.(System.Object[]) Arguments to be used in place of possible ?-chars within where string. List of previous call ids to be merged or stacked if class is $MERGE or $STACK. List of variable names and previous calls ids if class is $CALC.
Optionalcallback: TCallback<TGraphData>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Fetches NLS translations
Section to fetch language strings from.
Key within section or NULL.
SubKey within section/key or NULL.
Specifies what to do if translation is not found in desired language - should the fallback mechanism stop to english or return translation in any language.
Set true to include 'Standard' -section translations (containing strings like Ok, Cancel, Apply, Properties, ...).
(System.Int32) LanguageId to fetch language strings for or NULL to fetch for the strings for the currently active language. 32bit field, upper 16bits contains primary langid and lower 16bits sublangid.
Optionalcallback: TCallback<TFetchLanguageStringsResult>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Gets a list of formatted class property values from given raw values.
Name of the class
Names of the properties
(System.Object[]) RAW values of the properties
Optionalcallback: TCallback<TGetFormattedValuesResult>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Gets a key that can be used to pass the session to another application.
Optionalcallback: TCallback<string>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Gets a list of values that can be used to fill a drop down or similar control when editing a value on a property of an instance.
Name of the class, which instance is being modified
Name of the property, which is being modified
What user has typed so far, or null. Can contain wildcards * and ?.
Values of other modified properties in the instance.
(System.Int32) Maximum number of values to fetch, -1 for unlimited. If the result set is truncated due to this limit, the 'Truncated' value of the result structure is set to true.
Optionalcallback: TCallback<TGetStandardValuesResult>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Allows admin user to impersonate some other user. The session is turned to be authenticated to given user irreversibly.
Optionalcallback: TCallback<boolean>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Fetches stored set of properties from underlying database. The callback gets an object containing the properties read from the database.
(System.Guid) Bag Id - Unique id for the property bag to fetch.
(System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]) User Id, whose properties are to be fetched. Use null for current user.
(System.DateTime) Time of the property bag version to fetch.
Optionalcallback: TCallback<IPropertyBag>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
(Server type: ABB.Vtrin.cPropertyBag)
Sets the credentials that should be used when performing security checks for this frame. Only useful if passing multiple calls in the same frame. Supplying additional credentials may never give more access rights, only take some away.
(ABB.Vtrin.Drivers.cDriverSkeleton+cAccessInfo) Extra credentials to use when executing the consequtive calls in the same frame
Set true to persist the extra credentials until cleared with a second call to this function
Optionalcallback: TCallback<boolean>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Subscribes to listening changes of one or more instances. Returns ABB.Mia.cSubscribeChangesResult as the callback parameter whenever change to subscribed instances is detected until unsubscribe is called. The callback function for this call will be called multiple times as long as unsubscribe is called.
Name of the class, which changes should be sent. Set to null to get changes of all non-expiration based classes. When null, the properties parameter is ignored.
List of properties to be sent for changed instances, prefix with RAW: to get raw value instead of a pre-formatted value. Set to null to get full instances instead of the values of selected properties. Using $ACR or RAW:$ACR will fetch the access control rights for the instance. Using $REF will return the object reference string representing the instance. Prefix property name with VISIBLE: to get current visibility as boolean (true/false) determined by VisibilityRequirement property attribute.
The where mask for the subscription.
A where mask is a clause specifying a criteria for the fetch. Only instances that meet the criteria are included in the result set. The criteria consists of predicates using class properties (defined in ClassProperty class), operators and comparison values.
An example: "Name LIKE 'SYS*' AND (Type = 1 OR Type = 3)"
(Include instances whose Name starts with the string 'SYS' and whose Type is either 1 or 3.)
The syntax resembles SQL, but is not SQL. The supported operators are =, !=, >, >=, < and <=. AND, OR, LIKE, IN, IS and ORDER BY are supported however IS is used for type checking, not for null checks (eg. Unit IS System.Int32) - null checks are done by just using null like any other value (eg. Unit=null). Wildcards for LIKE are * and ?. SQL injection attacks will not work as this is not SQL.
(System.Object[]) Arguments to be used in place of possible ?-chars within where string.
Optionalcallback: TCallback<TSubscribeChangesResult>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Subscribes to listening of connection health events. This is meaningful only if the server operates in 'gateway mode', meaning it is connected to another server, in which case these events provide information on that connection's (and any subconnections) health.
Optionalcallback: TCallback<TSubscribeConnectionHealthEventsResult>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Subscribes an equipment session. All the equipment and their properties are processed by the server and wanted property subscriptions are returned to the client by the server.
The definition of equipment(s) to use in the equipment session. See documentation for a detailed description of a equipment definition.
Optionalcallback: TCallback<unknown>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Subscribes to polling of a history value. Returns {NYI} whenever change to target value is detected until unsubscribe is called. Note that unlike with other calls, the callback function for this call will be called multiple times as long as unsubscribe is called.
Name of the class, which the fetch is to be executed on.
Name of the time property in the class defined by the classname.
Name of the value property in the class defined by the classname.
Optional filter to apply on data, eg. AVG1MIN to get one minute averages, see Vtrin documentation for further info on filters.
The where mask for the subsciption.
A where mask is a clause specifying a criteria for the fetch. Only instances that meet the criteria are included in the result set. The criteria consists of predicates using class properties (defined in ClassProperty class), operators and comparison values.
An example: "Name LIKE 'SYS*' AND (Type = 1 OR Type = 3)"
(Include instances whose Name starts with the string 'SYS' and whose Type is either 1 or 3.)
The syntax resembles SQL, but is not SQL. The supported operators are =, !=, >, >=, < and <=. AND, OR, LIKE, IN, IS and ORDER BY are supported however IS is used for type checking, not for null checks (eg. Unit IS System.Int32) - null checks are done by just using null like any other value (eg. Unit=null). Wildcards for LIKE are * and ?. SQL injection attacks will not work as this is not SQL.
(System.Object[]) Arguments to be used in place of possible ?-chars within where string.
(System.Nullable1[[System.TimeSpan, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]) Interval to poll for new values. Default one minute. @param {unknown} timeshift (System.Nullable1[[ABB.Vtrin.cAdvancedTimeSpan, VtrinLib, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null]]) TimeShift when fetching the values, relative to current time. Default 0.
(System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]) Basetime when fetching periodical data using filters. Default 2300-01-01.
Optionalcallback: TCallback<TSubscribeHistoryValueResult>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Subscribes a data push ability. Once subscribed, you can utilize web socket connection for pushing the values using the returned subscription id so that you only pass the data values in further calls.
Name of the target class, which will receive the data.
(System.Object) Id of target instance if updating (see pushtype) or null.
List of properties to set.
(System.Int32) Type of push operation 0=Insert, 1=Update, 2=ForceUpdate, 3=ProcessValue.
Optionalcallback: TCallback<number>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
(Server type: System.Double)
Unsubscribes listening to changes that have been previously subscribed with Subscribe -call.
(System.Int64) Call id of subscription to cancel.
Optionalcallback: TCallback<boolean>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Writes a set of properties to underlying database. The call back gets boolean true on successful commit (there is no need to check the value as the exception callback will be fired on failure).
(ABB.Vtrin.cPropertyBag) PropertyBag containing the common properties to write.
(ABB.Vtrin.cPropertyBag) PropertyBag containing the user specific properties to write.
(System.Object) Bag Id - Unique id for the property bag.
(System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]) User Id, whose properties are to be saved. Use null for current user.
Optionalcallback: TCallback<boolean>Function called when the requested operation is completed.
Optionalexceptionhandler: TExceptionFunction called in case the requested operation causes an error.
Server API Interface