Sets the value of the specified data point (or dynamic global variable).

Name Description
SET(string, object) Sets the value of the specified data point.
SET(string, object, int) Sets the value of the specified data point, along with its quality.
SET(string, object, int, DateTime) Sets the value of the specified data point, along with its quality and timestamp.

This global function assigns a value to the named point or global variable. If the assignment is to a point, the value is coerced to one of Double, Int32 or String and then written to the Cogent DataHub. Otherwise the value is stored without modification. The coercion will never fail, and will produce a string for all non-numeric values or for values that cannot be represented in a Double or Int32. If a named point does not exist, SET will create the point where permissions permit. If a named global variable does not exist, this function creates a new global variable with the same structure as a data point.

Quality is an optional integer argument, which represents an OPC quality. If not passed, the DataHub will assign a quality of 192 (0xC0, GOOD).

Timestamp is an optional argument, either as a Double (an OADate in UTC) or a DateTime in local time. If not passed, the DataHub will assign the timestamp using the server date and time. Allowing the timestamp to be set by the DataHub is best practice.

This example illustrates how to set the value of data points:
  • MyProcess:Start - is a server-side data point managed by the DataHub
  • isRunning - is a local data point managed by the WebView client (i.e., not shared with other users)
  WV.WaitBox("Process is running. Please wait.", "My Process");
  SET("MyProcess:Start", 1);
  SET("isRunning", 1);