SetTagValue

Called to modify the value of a tag

🔁 Function

void SetTagValue(
    id: number, 
    value: object
    );

void SetTagValue(
    name: string, 
    value: object);

⚙️ Parameters

Name Type Description
id or name Number or String Either the unique number returned from the call to SubscribeToTag or the name of the tag.
value object The new value of the tag

↩️ Return Value

None

Warnings

A warning is produced in Message Viewer if SetTagValue is called with mismatched data type.

📝 Example

Set tag value by id:

_tag1 = SubscribeToTag("Tag1", 500, null, Tag1ValueChanged);
SetTagValue(_tag1, 5); 

Set tag value by string:

SetTagValue("Tag1", 5);