Guide Section: Processing Events and Performing Actions
EASAP Tree: EVENT PROCESSING > ACTION
SET PROTOTYPE is an advanced feature used to manipulate LISTs and SCALARs and trigger ACTIONs using the Java-like scripting language Groovy.
Either File: or Text: must contain the Groovy source script.
There must be at least one use of each object listed in:
Groovy API Documentation is a useful reference.
![]() |
|
---|---|
Essential Parameters: | |
Parameters: | Select input LISTs and SCALARs that will be available by name in the script block |
Outputs: | Enter names for any new LISTs that will contain output data from a Groovy script |
Optional Parameters: | |
Text: | Enter Groovy script text to run |
File: | Select filename containing the Groovy script text |
Action Parameters: | Enter names of any ACTION GROUPs which may be ' .run(); ' by the script, example below |
Do If: | Enter a logical expression which, if true will allow script to be executed |
A SCALAR input will be available as a 'Groovy String'.
A LIST input will be available as a 'Groovy Vector'.
New objects in Outputs: will always be explicit LISTs regardless of the context in the Groovy script.
If a Groovy variable has a single value instead of a list of values, an Author will find the single value result as the first value of the explicit LIST.
Below is a simple Groovy script in an EASAP to allow the user to enter a person's name and the script creates a greeting which is displayed in a LABEL.
This example creates an EASAP with the interface below:
First set up an EASAP with the objects below:
The EASAP executes as follows:
The Tree below outlines an EASAP that:
This scripts requires Parameters:, Outputs: and Action Parameters: to be declared as they are in the screenshot below.
Reading columns from a single Excel table creates LIST's that vary in length from each other if any of the last element(s) in the column are blank. However DATABASE→WRITE requires LIST's be of equal length. To remedy this in Groovy we create a LIST of blank elements for each column that we will CONCATENATE with the Excel-derived LIST to make all LIST's the same length.
For a SET PROTOTYPE set:
This script below creates three lists of blank elements that will be concatenated to each existing LIST to make them all maxLength elements long.
ArrayList<String> col1padding = new ArrayList<>(); ArrayList<String> col2padding = new ArrayList<>(); ArrayList<String> col3padding = new ArrayList<>(); int maxLength = 0; if(maxLength < Integer.valueOf(list1_length)){ maxLength = Integer.valueOf(list1_length); } if(maxLength < Integer.valueOf(list2_length)){ maxLength = Integer.valueOf(list2_length); } if(maxLength < Integer.valueOf(list3_length)){ maxLength = Integer.valueOf(list3_length); } for (int i =0;i<maxLength - Integer.valueOf(list1_length);i++){ col1padding.add(""); } for (int i =0;i<maxLength - Integer.valueOf(list2_length);i++){ col2padding.add(""); } for (int i =0;i<maxLength - Integer.valueOf(list3_length);i++){ col3padding.add(""); } col1pad=col1padding; col2pad=col2padding; col3pad=col3padding;