"Nested macro"

CharlieFirpoCharlieFirpo Member Posts: 48 Contributor II
edited June 2019 in Help
Dear all!

It is possible to use macro(macro("name_of_macro")) to get a value, so nested macros work. But what if an operator does not support RapidMiner functions like 'macro()'. One should use the formula: '%{name_of_macro}'. But in that form, does nested macros work? Like: %{%{name_of_macro}}. How can I get a value in that way?

Thank you!


  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    D'oh, that's good ol' C pointers to pointers... In RapidMiner you need to create yet another macro with Generate Macro, which can then be used in any desired field. See attached process.
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.013">
      <operator activated="true" class="process" compatibility="5.3.013" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="set_macro" compatibility="5.3.013" expanded="true" height="76" name="Set Macro" width="90" x="45" y="30">
            <parameter key="macro" value="a"/>
            <parameter key="value" value="value"/>
          <operator activated="true" class="set_macro" compatibility="5.3.013" expanded="true" height="76" name="Set Macro (2)" width="90" x="179" y="30">
            <parameter key="macro" value="b"/>
            <parameter key="value" value="a"/>
          <operator activated="true" class="generate_macro" compatibility="5.3.013" expanded="true" height="76" name="Generate Macro" width="90" x="447" y="30">
            <list key="function_descriptions">
              <parameter key="desiredOutput" value="macro(macro(&quot;b&quot;))"/>
          <operator activated="true" class="print_to_console" compatibility="5.3.013" expanded="true" height="76" name="Print to Console" width="90" x="581" y="30">
            <parameter key="log_value" value="%{desiredOutput}"/>
          <connect from_op="Set Macro" from_port="through 1" to_op="Set Macro (2)" to_port="through 1"/>
          <connect from_op="Set Macro (2)" from_port="through 1" to_op="Generate Macro" to_port="through 1"/>
          <connect from_op="Generate Macro" from_port="through 1" to_op="Print to Console" to_port="through 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
Sign In or Register to comment.