WriteValue Function

The WriteValue function writes a single key/value pair (a value and a unique name for that value) to your modular output system outputs.

The following parameters are supported…

ParameterDefaultMeaning
nameThe name (key) for the key/value pair. This may contains '/' symbols if the value is hierarchial
valueThe value for the key/value pair. This should be a number or string
optionsNoneOptions to pass to the function (see Options)
forceFalseIf true, forces the write to take place even if there is no change in value
configNoneContains additional outputs/destinations

Parameters

Name & Value

The name and value are simple - it's the value you want to write, and a unique identifying name for that value.

oe.WriteValue("Temperature5",25.2)
Options

Options are passed as a dictionary of option names and values.

Option NameMeaning
datatypeForces a certain data type - for example, 'text'

Other options can be used as conditions for different output methods. For example, you might write a value with the following options…

oe.WriteValue("Temperature1",22.1,options={"group": "low_priority"})

…and rules inside your output configuration can then ensure that the output is treated as a low rather than high-priority value.

Force

By default, changes aren't written to the destinations if the value hasn't changed. The force parameter tells the system to write the results to the destination, even if no change has happened.

Config

In some cases, your application might have a specific destination in mind for the results. This allows you to send a dictionary containing output configuration details.

This lets you provide a UI to the user setting up specific, per-point delivery rules.

oe.WriteValue("Pressure5",1126,config=[{"method": "text", "path": "c:\testing\sample.txt"}])