quot:incomingvalue_quot:and_server_values

This is an old revision of the document!


In scripts, the variable “incomingValue” represents the proposed new value for the server - the value read from the device or used to update the server. This is only a proposal, within your script, you are able to change this and so that actual value of the server will become the value output from your script.

An obvious case is scaling. This single line script will result in the value of the server being one tenth the value read from the device.

incomingValue/10;
The value on the last line of the script is the “return” value. That is, this will become the value of the server.

You can still get the current value of the server by referencing the server by name.

/Devices/MyServers_Servers/MyServer->getValueObject();

This value (/Devices/MyServers_Servers/MyServer→getValueObject()) will not be updated until after your script has run so can be thought of as representing the “old” or “last” value and the incomingValue can be thought of as the “new” or “proposed” value.

If the last line of the script does not have a value, the “incomingValue” will become the value of the server after the script returns, so the script:

print ("Incoming Value" + incomingValue.getStringValue());

will result in the server being set to the value of “incomingValue”.

If you find you're getting results that are one reading behind what you expect, check to make sure that you're using the incomingValue, not the old server value in your scripts.

  • quot/incomingvalue_quot/and_server_values.1601671899.txt.gz
  • Last modified: 2020/10/02 15:51
  • by wikiadmin