Scripting and Multiple Input/Output [SOLVED]

tbagley85
New Altair Community Member
Hi, guys,
New guy here. I'm writing a script in Groovy using the Execute Script operator and I'm having some issues with the inputs. I know that it is easy to retrieve the first input (operator.getInput(SomeClass.class)). But if I have multiple inputs, how would I access the second/third/nth?
And for outputs, is there an operator.setOutput or similar function? Because of course you can only return one value from a Java/Groovy function.
Thanks!
New guy here. I'm writing a script in Groovy using the Execute Script operator and I'm having some issues with the inputs. I know that it is easy to retrieve the first input (operator.getInput(SomeClass.class)). But if I have multiple inputs, how would I access the second/third/nth?
And for outputs, is there an operator.setOutput or similar function? Because of course you can only return one value from a Java/Groovy function.
Thanks!
Tagged:
0
Answers
-
Hi,
access inputs via
to return multiple outputs, see my second answer below.
ExampleSet myData = input[0];
ExampleSet alsoData = input[1];
Regards,
Marco0 -
Hi, Marco,
Thanks so much for your help! The input works great but I'm having some trouble with the output. I am getting a warningWARNING: Unknown result: class com.rapidminer.operator.IOContainer:IOContainer(3 objects)
The rest of the warning goes on to describe the example sets in the container, which are correct. However, none of the operators to which I connect the output ports are receiving any data. Thoughts?
Thanks again.0 -
Hi,
sorry my bad. You can simply do the following:
Regards,
import java.util.LinkedList;
import java.util.List;
// main code
// return multiple outputs via List
List<IOObject> returnList = new LinkedList<>();
returnList.add(input[0]);
returnList.add(exSet);
return returnList;
Marco0 -
Thanks man you're a lifesaver0