RapidMiner 9.7 is Now Available

Lots of amazing new improvements including true version control! Learn more about what's new here.

CLICK HERE TO DOWNLOAD

Use a Loop Macro in a Function Expression

mugicagonzalez_mugicagonzalez_ Member Posts: 14 Contributor II
edited January 2019 in Help
Hello all

It's possible to "Generate Attribute" with a function expression that includes an attribute (for example var1 = var + 1).
If I now want to replace these variables with macros, it doesn't work (because it is seen as text, and not as a variable). (for example %{loop-var} = %{loop-var} + 1

Example in here (all imported vars starting with Wh are numerical).
<?xml version="1.0" encoding="UTF-8"?><process version="8.1.003">  <context>    <input/>    <output/>    <macros/>  </context>  <operator activated="true" class="process" compatibility="8.1.003" expanded="true" name="Process">    <process expanded="true">      <operator activated="true" class="retrieve" compatibility="8.1.003" expanded="true" height="68" name="Retrieve values" width="90" x="45" y="34">        <parameter key="repository_entry" value="//Local Repository/data/delete_me/values"/>      </operator>      <operator activated="true" class="concurrency:loop_attributes" compatibility="8.1.003" expanded="true" height="82" name="Loop Attributes" width="90" x="179" y="34">        <parameter key="attribute_filter_type" value="regular_expression"/>        <parameter key="regular_expression" value="Wh_.+"/>        <parameter key="attribute_name_macro" value="loop_Wh"/>        <parameter key="enable_parallel_execution" value="false"/>        <process expanded="true">          <operator activated="true" class="generate_attributes" compatibility="8.1.003" expanded="true" height="82" name="Generate Attributes (11)" width="90" x="112" y="34">            <list key="function_descriptions">              <parameter key="k%{loop_Wh}" value="%{loop_Wh} / 1000"/>            </list>          </operator>          <connect from_port="input 1" to_op="Generate Attributes (11)" to_port="example set input"/>          <connect from_op="Generate Attributes (11)" from_port="example set output" to_port="output 1"/>          <portSpacing port="source_input 1" spacing="0"/>          <portSpacing port="source_input 2" spacing="0"/>          <portSpacing port="sink_output 1" spacing="0"/>          <portSpacing port="sink_output 2" spacing="0"/>        </process>      </operator>      <connect from_op="Retrieve values" from_port="output" to_op="Loop Attributes" to_port="input 1"/>      <connect from_op="Loop Attributes" 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"/>    </process>  </operator></process>


How do I bypass this?

Thanks
Pello 

Best Answer

  • mugicagonzalez_mugicagonzalez_ Member Posts: 14 Contributor II
    Solution Accepted
    Solved by using the "eval" function: eval(%{loop-var}) = eval(%{loop-var}) + 1
    BalazsBaranymschmitz
Sign In or Register to comment.