Homepage | About EASA | Contact
Guide Section: Processing Events and Performing Actions | EASAP Tree: EVENT PROCESSING → ACTION
SET PROTOTYPE is an advanced feature used to manipulate LIST's and SCALAR's and trigger ACTION's using the Java-like scripting language Groovy.
One of either File: or Text: parameters must contain the Groovy source script.
Groovy API Documentation is a useful reference.
![]() |
|
---|---|
Essential Parameters: | |
Parameters: | Input LIST's and SCALAR's that will be available by name in the script block. |
Outputs: | Declaration of any new object references that will contain output data from a Groovy script |
Optional Parameters: | |
Text: | The Groovy script text to run. |
File: | A file containing the Groovy script text. |
Action Parameters: | Names of ACTION GROUP's available to be .run(); by the script. (example below) |
Do If: | Logical expression. Script executed if this evaluates to 'TRUE' |
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 LIST's 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 are three examples:
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:
This insures that values are refreshed following the script execution.
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:
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;