The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Scripting and Multiple Input/Output [SOLVED]

tbagley85tbagley85 Member Posts: 5 Contributor II
edited November 2018 in Help
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!

Answers

  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee-RapidMiner, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    access inputs via

    ExampleSet myData = input[0];
    ExampleSet alsoData = input[1];
    to return multiple outputs, see my second answer below.

    Regards,
    Marco
  • tbagley85tbagley85 Member Posts: 5 Contributor II
    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 warning
     WARNING: 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.
  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee-RapidMiner, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    sorry my bad. You can simply do the following:

    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;
    Regards,
    Marco
  • tbagley85tbagley85 Member Posts: 5 Contributor II
    Thanks man you're a lifesaver  :)
Sign In or Register to comment.