system.sfc.setVariables

Description

Sets any number of variables inside a currently running chart.

Syntax

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

  • Parameters

String instanceId - The instance identifier of the chart.

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

PyObject variablesMap - A dictionary containing the name:value pairs of the variables to set.

  • Returns

Nothing

  • Scope

All

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)