This function is used in Python Scripting.

Description

Sets any number of variables inside a currently running chart.

Client Permission Restrictions

Permission Type: SFC Management

Client access to this scripting function is blocked to users that do not meet the role/zone requirements for the above permission type. This function is unaffected when run in the Gateway scope.

Syntax

system.sfc.setVariables(instanceId, [stepId], variableMap)

  • Parameters

String instanceId - The instance identifier of the chart.

String stepId -  The id for a step inside of a cart. If omitted the function will target a chart scoped variable. [optional]

Dictionary[String, Any] variablesMap - A dictionary containing the name:value pairs of the variables to set.

  • Returns

Nothing

  • Scope

Gateway, Vision Client, Perspective Session

Omitting the stepId parameter will cause the function to target a chart scoped variable. If the variable is persistent to the whole chart, or used in multiple different steps, then this parameter should be omitted.

If a stepId parameter is used, then the function will target a step scoped variable. The step associated with the stepId must be the currently active step.

Code Examples
Code Snippet
# Get the instance ID from the selected chart on a SFC Monitor component.
id = event.source.parent.getComponent('SFC Monitor').instanceId
 
# Create a Python dictionary of values. This example assumes there are variables on the
# chart named chartParam and counter. The script will set these to 1, and 0 respectively.
dict = {"chartParam":1, "counter":0}

# Set the variables on the chart.
system.sfc.setVariables( id, dict)
Keywords

system sfc setVariables, sfc.setVariables