OPC Studio User's Guide and Reference
WriteFunction Method



OpcLabs.ServerOpcUA Assembly > OpcLabs.EasyOpc.UA.NodeSpace Namespace > UADataVariableExtension Class : WriteFunction Method
Modifies the data variable for consuming attribute data by a specified function, for the push data consumption model.

This method always makes the data variable writable, including its status code and source timestamp, i.e. OPC UA clients will be able to modify them. If you need a different behavior, call the Writable(UADataVariable,Boolean,Boolean,Boolean) method subsequently, with desired parameters, or modify the UADataVariable.WritableStatusCode and/or UADataVariable.WritableSourceTimestamp accordingly (set one or both to true).

This method does not change the readability access of the data variable. By default, data variables are readable. If you need a data variable that is writable but non-readable, combine this method with calling Readable(UADataVariable,Boolean) method with the 'readable' parameter set to false.

The write function returns a OpcLabs.EasyOpc.UA.UAStatusCode that indicates the outcome of the OPC UA write operation. The WriteFunction(UADataVariable,Type,Func<UAAttributeData,UAStatusCode>) method overloads are the most generic extensions methods for writing. If you only need to deal with the data variable value (and not its status code and/or timestamp), consider using one of the WriteValueFunction<TValue>(UADataVariable,Type,Func<TValue,UAStatusCode>) or WriteValueAction<TValue>(UADataVariable,Type,Action<TValue>) method overloads, for shorter code and easier programming.

Overload List
OverloadDescription
Makes data variable that consumes the attribute data using the write function. Specify the value type.  
Makes data variable that consumes the attribute data using the write function. Specify the value type code.  
Makes data variable that consumes the attribute data using the write function. Specify the data type Id. Uses an empty array dimension list.  
Makes data variable that consumes the attribute data using the write function. Specify the data type Id and array rank.  
Makes data variable that consumes the attribute data using the write function. Specify the data type Id and array dimension list.  
Makes data variable that consumes typed attribute data using the write function.  
Makes data variable that consumes typed attribute data using the write function, and specifying array dimensions.  
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also