Configure Script for Analysis Table

Configure Script

The Script for Analysis Table set-up on the window REC_02_SCR/03_Analysis has two main components:

  1. Button (Ignition)
  2. Power Table (Ignition)

Configure Power Table

  • Drag an Ignition Power Table onto the screen. Position and resize it across the screen, as shown above.

  • No configuration is required (data will be pushed in by the script in the Button).



Configure Button

  • Drag an Ignition Button component onto the screen. Place it above the Power Table and resize it to fit the text shown above.
  • Set the Text property to Populate Recipe Settings to Table.
  • Open the Component Scripting dialog box (Ctrl-J), select the actionPerformed event handler script area and paste in the following script.

Script for the actionPerformed event handler

Code
eqPath = 'New Enterprise\\Site\\Area\\Line 1'
##Get the Current Recipe that is applied to the Line
recipeName = system.recipe.getCurrentItemRecipe(eqPath)
print recipeName

##Get the List of Possible Recipes for the Line
possibleRecipes = system.recipe.getItemRecipeList(eqPath, '*')
print possibleRecipes

##Get the List of recipe value items at the line and build a dataset. Then push the dataset to the table
list = system.recipe.getRecipeValueList(eqPath, recipeName, "")
print list
header = ['Recipe Value Item Name', 'Value']
data = []
if list:
	for rv in list:
		data.append([str(rv), str(rv.getRecipeValue())])
	
ds = system.dataset.toDataSet(header, data)
ds = system.dataset.sort(ds, 'Recipe Value Item Name')
event.source.parent.getComponent('Power Table').data = ds