"How to set process inputs using macros?"

excessukexcessuk Member Posts: 3 Contributor I
edited June 2019 in Help

Apologies if this question has been asked before - I search the forums exhaustively but couldn't find the answer to my question.

I created a process which uses macros to filter the resulting data, and that's working fine, I think I got the hang of how macros work. However now I need to change the input of the process using a macro too and I can't figure out how to do it? Basically I have lots of example sets having exactly the same metadata, so instead of creating one process per example set I wanted to use the same process but change the process input using a macro.

Say my example sets are called "Data_SomeName_101", "Data_SomeName_102", etc. I want to have a macro called "input" and pass the value "Data_SomeName_101" (or whatever the example set is called) and have the process recognise that as an input.

Does anyone know how to do that?

Thanks in advance and happy new year!



  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi Marcelo,

    you can wrap your process in a Loop operator like in the process below, activate the option "set iteration macro" and then use the macro to assemble the name of the input data. Have a look at the process below.

    You could also use the Execute Process operator and embed it into another process which executes the loop, and pass macros via the macros parameter of that operator.

    Best regards,
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.1.015">
      <operator activated="true" class="process" compatibility="5.1.015" expanded="true" name="Process">
        <process expanded="true" height="145" width="279">
          <operator activated="true" class="loop" compatibility="5.1.015" expanded="true" height="76" name="Loop" width="90" x="179" y="30">
            <parameter key="set_iteration_macro" value="true"/>
            <parameter key="iterations" value="10"/>
            <process expanded="true" height="634" width="743">
              <operator activated="true" class="retrieve" compatibility="5.1.015" expanded="true" height="60" name="Retrieve" width="90" x="112" y="30">
                <parameter key="repository_entry" value="some_name_%{iteration}"/>
              <connect from_op="Retrieve" from_port="output" to_port="output 1"/>
              <portSpacing port="source_input 1" spacing="0"/>
              <portSpacing port="sink_output 1" spacing="0"/>
              <portSpacing port="sink_output 2" spacing="0"/>
          <connect from_op="Loop" from_port="output 1" to_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
Sign In or Register to comment.