system.sfc.getRunningCharts
This function is used in Python Scripting.
Description​
Retrieves information about running charts. Can search all running charts, or be filtered charts at a specific path. This function will return charts that are in a Paused state.
Client Permission Restrictions​
This scripting function has no Client Permission restrictions.
Syntax​
system.sfc.getRunningCharts([chartPath])
Parameters​
Type | Parameter | Description |
---|---|---|
String | chartPath | The path to a chart to filter on: i.e., "folder/chartName". If specified, only charts at the path will be included in the returned dataset. If omitted, the function will return data for all active charts |
Returns​
Dataset - A dataset with information on the active chart. Contains the following columns:
- instanceId - the chart instance, or UUID of the chart.
- chartPath - The path to the chart.
- startDate - A date object noting when the chart instance started.
- startedBy - The name of the user that started the chart.
- chartState - The current state of the chart. Possible states are "Running" and "Paused".
- keyParamName - Name of the chart's Key Parameter. Returns None if a Key Parameter is not defined.
- keyParamValue - Value of the chart's Key Parameter. Returns None if a Key Parameter is not defined.
Scope​
Gateway, Vision Client, Perspective Session
Code Examples​
Example #1 - Check All Running Charts
# This example will check for all running charts, and return a formatted string detailing each chart instance.
# Check for all running charts. The path may be specified as a string to filter the results.
data = system.sfc.getRunningCharts()
# Create a string to append chart data to. The "\n" is a new line character.
chartData = "The following charts are running:\n"
# Iterate through each chart
for row in range(data.rowCount):
# Extract the instanceId and chartPath values from the current row
runningChartId = data.getValueAt(row, "instanceId")
runningChartPath = data.getValueAt(row, "chartPath")
# Append a string to chartData with the values extracted above
chartData += "Id: %s, Path: %s\n" % (runningChartId, runningChartPath)
# Print the string of chart Id's and Paths
print chartData
Example #2 - Retrieve Chart 'instanceId' Using 'chartPath'
# This example will return the instanceId of chart instances with a specific chartPath.
# A valid path must be defined for this example.
# Return data for running instances at a specific path. "folder/myChart" should be replaced with a valid path.
data = system.sfc.getRunningCharts("folder/myChart")
# Initialize a list to contain all instance Ids
chartIds = []
# Iterate through each chart, and fetch the instanceId
for row in range(data.rowCount):
chartIds.append(data.getValueAt(row, "instanceId"))
# Print the chartIds list
print chartIds