Introduction

Will have some whole workflow documents here, showing how scripting features can be integrated into workflows.

Defining Constants

Control flow based on results of previous step

Iteration with variable tool parameters

Parallel iteration with variables

Self-Modifiying Workflows

workflow scripts may add dynamically parameter values to tool elements

// access result of previous step
  votable = source.result;
//create new parser
  parser = new XmlParser();
//parse votable into node tree
  nodes = parser.parseText(votable);
// filter node tree on 'TD', extract value attribute
  urls = nodes.depthFirst().findAll{it.name() == 'TD'}.collect{it.value()}.flatten();
// show what we've found
  print(urls);
// find next step in workflow
 sinkStep = jes.getSteps().find {it.name == 'sink-step'};
// get to set of input parameters
  inputs = sinkStep.tool.input;
// for each url, create new parameter, populate, add to inputs.
  urls.each { p = jes.newParameter(name:'url', value:it); inputs.addParameter(p);}