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

"Macro Madness"

ndoromalndoromal Member Posts: 5 Learner III
edited June 2019 in Help

Hi All-

I'm new to the RM community and this is my first forum post (so please go easy :)

 

I'm trying to do basic arithmetic with a macro; I want to assign a value to a macro and then decrement it by one. (The sad thing is that there is probably a better way to achieve the same end for the process, but I've invested so much time, at this point, I want to figure out how to do this.)

 

I've tried a number of approaches:

   using eval(%{MACRO_NAME}) syntax
   using #{MACRO_NAME} syntax

   eval(%{MACRO_NAME}) - 1

   eval(%{MACRO_NAME} -1)

   using one macro (setting MACRO_NAME value and then setting MACRO_NAME to MACRO_NAME - 1

   using two macros (setting MACRO_NAME value and then setting MACRO2 to MACRO_NAME - 1

   using the Generate Macro operator

   using the Set Macro operator

 

I'm having trouble attaching the process, so apologies for not posting it.

 

Thank you in advance for the help!

 

-Noel

--

 

macro.jpg

 

   

 

Best Answer

  • lionelderkrikorlionelderkrikor RapidMiner Certified Analyst, Member Posts: 1,195 Unicorn
    Solution Accepted

    Hi @ndoromal,

     

    First, I have a good new and a bad new : 

    Good new : you have correctly applied the rules of the community : You shared your process and the same can not be said of everyone, so congratulations.:catvery-happy:

    Bad new : Your process is broken : I can not be loaded in RapidMiner....:catsad:

     

    Now the serious things : 

    I don't know what is your final goal (a time-series study...?), but here a sample process which performs what you want to do : 

    Generate_Macro.png

     

    the process : 

    <?xml version="1.0" encoding="UTF-8"?><process version="9.0.000-BETA">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="9.0.000-BETA" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="retrieve" compatibility="9.0.000-BETA" expanded="true" height="68" name="Retrieve Golf" width="90" x="179" y="85">
    <parameter key="repository_entry" value="//Samples/data/Golf"/>
    </operator>
    <operator activated="true" class="extract_macro" compatibility="9.0.000-BETA" expanded="true" height="68" name="Extract Macro" width="90" x="313" y="85">
    <parameter key="macro" value="macro_name"/>
    <list key="additional_macros"/>
    </operator>
    <operator activated="true" class="generate_macro" compatibility="9.0.000-BETA" expanded="true" height="82" name="Generate Macro" width="90" x="447" y="85">
    <list key="function_descriptions">
    <parameter key="macro_name_2" value="eval(%{macro_name})-1"/>
    </list>
    </operator>
    <connect from_op="Retrieve Golf" from_port="output" to_op="Extract Macro" to_port="example set"/>
    <connect from_op="Extract Macro" from_port="example set" to_op="Generate Macro" to_port="through 1"/>
    <connect from_op="Generate Macro" from_port="through 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>

    I hope it helps,

     

    Regards,

     

    Lionel

Answers

  • ndoromalndoromal Member Posts: 5 Learner III

    I've attached my process

    <?xml version="1.0" encoding="UTF-8"?><process version="8.2.001">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="8.2.001" expanded="true" name="Process">
    <process expanded="true">
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    </process>
    </operator>
    </process>

    (after rereading the instructions :)

  • ndoromalndoromal Member Posts: 5 Learner III

    Hi Lionel-

    Thank you so much! I was working on this late last night... I probably should have hit pause and resumed this morning. Your help is greatly appreciated!

  • lionelderkrikorlionelderkrikor RapidMiner Certified Analyst, Member Posts: 1,195 Unicorn

    Hi,

     

    You're welcome @ndoromal

     

    Now you can sleep on both ears.:catwink:

     

    Regards,

     

    Lionel

Sign In or Register to comment.