User Tools

Site Tools


Guide Section: Processing Events and Performing Actions | EASAP Tree: EVENT PROCESSINGACTION

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.

  • There must be at least one use of each object listed in,
    • Parameters:
    • Outputs:
    • Action Parameters:

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:

  1. A simple Groovy script
  2. Use of Action Parameters:
  3. Pad the ends of LIST's from Excel prior to writing to a database

1. Simple Groovy Example

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:

  • an INPUTBOX for entering a person's name
  • a BUTTON with
    • a Child SET PROTOTYPE
  • a LABEL to display the output DOR, groovyDOR.

First set up an EASAP with the objects below:

  • For menu-action1
    • Set Menu Action: 'Refresh'

This insures that values are refreshed following the script execution.

  • For set_prototype1 set parameters below:

The EASAP executes as follows:

  • User enters a name
  • button1 triggers set_prototype1
    • Groovy concatenates 'hello ' with the inputbox1
    • result is returned as groovyDOR.
  • menu_action1 refreshes all DORs
  • groovyDOR is displayed in a LABEL

2. Groovy example using Action Parameters:

The Tree below outlines an EASAP that:

  • opens a browser (action_group1) when a TABBED PANE is selected
  • a BUTTON triggers a SET PROTOTYPE
    • the Groovy script in Text: runs which:
      • assigns inputbox1 to output
      • calls

This scripts requires Parameters:, Outputs: and Action Parameters: to be declared as they are in the screenshot below.

3. Pad LIST's from Excel prior to writing to a database

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.


  • Set:
    • Parameters: list1_length, list2_length,list3_length
    • Outputs: col1pad,col2pad,col3pad
    • File: script.txt

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(""); }

Page Tools