Top  | Previous | Next

Scripting Reference

This section serves as a reference to the scripting API methods available for sequential function charts.

 

Chart Scope Variables

There are a number of built-in variables maintained by the SFC engine that can be read through the chart scope.

chart.instanceId - the string UUID of the running chart instance.
chart.startTime - a java.util.Date object that indicates when the chart instance started running.
chart.runningTime - an integer representing the number of seconds the chart has been running for.
chart.parent - the chart scope of the enclosing chart (if any). null if this chart was not executed as part of an enclosing step.
chart.running - returns true if the chart is in the running state
chart.state - an integer representing the state of the chart.

0

Aborted

6

Pausing

1

Aborting

7

Resuming

2

Canceled

8

Running

3

Canceling

9

Starting

4

Initial

10

Stopped

5

Paused

11

Stopping

 

Scripting API system.sfc.*

system.sfc.startChart(path, arguments)

Starts a new instance of a chart. The chart must be set to "Callable" execution mode.

path

The path to the chart, for example "ChartFolder/ChartName"

arguments

A dictionary of arguments. Each key-value pair in the dictionary becomes a variable in the chart scope. Will overwrite any default argument values specified by the chart's "Begin Step".

returns

A string, which represents the unique ID of this chart.

 

 

system.sfc.cancelChart(id)

Cancels the execution of a running chart instance. Any running steps will be told to stop, and the chart will enter Canceling state.

id

The ID of the chart instance to cancel.

returns

nothing

throws

Will throw a KeyError if the ID does not match any running chart instance.

 

system.sfc.pauseChart(id)

Pauses a running chart instance. Any running steps will be told to pause, and the chart wil enter Pausing state.

id

The ID of the chart instance to pause.

returns

nothing

throws

Will throw a KeyError if the ID does not match any running chart instance.

 

system.sfc.resumeChart(id)

Resumes a chart that was paused. Steps which were previously paused will be resumed, and chart will enter Resuming state.

 

id

The ID of the chart instance to resume.

returns

nothing

throws

Will throw a KeyError if the ID does not match any running chart instance.