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

"rename attributes in loop"

gritsaygritsay Member, University Professor Posts: 12 University Professor
edited June 2019 in Help
Hi! I do process with loop attribute. In the param %{loop_attribute} stored name of attribute on each iteration. How i can rename this attribute on each iteration? rename operator not working with macro.

Alex.

Answers

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

    it does ???
    Have a look at the following process:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="6.0.009">
     <context>
       <input/>
       <output/>
       <macros/>
     </context>
     <operator activated="true" class="process" compatibility="6.0.009" expanded="true" name="Process">
       <process expanded="true">
         <operator activated="true" class="retrieve" compatibility="6.0.009" expanded="true" height="60" name="Retrieve Iris" width="90" x="45" y="30">
           <parameter key="repository_entry" value="//Samples/data/Iris"/>
         </operator>
         <operator activated="true" class="loop_attributes" compatibility="6.0.009" expanded="true" height="76" name="Loop Attributes" width="90" x="179" y="30">
           <process expanded="true">
             <operator activated="true" class="generate_macro" compatibility="6.0.009" expanded="true" height="76" name="Generate Macro" width="90" x="45" y="30">
               <list key="function_descriptions">
                 <parameter key="name" value="concat(&quot;%{loop_attribute}&quot;, &quot;_0&quot;)"/>
               </list>
             </operator>
             <operator activated="true" class="rename" compatibility="6.0.009" expanded="true" height="76" name="Rename" width="90" x="246" y="30">
               <parameter key="old_name" value="%{loop_attribute}"/>
               <parameter key="new_name" value="%{name}"/>
               <list key="rename_additional_attributes"/>
             </operator>
             <connect from_port="example set" to_op="Generate Macro" to_port="through 1"/>
             <connect from_op="Generate Macro" from_port="through 1" to_op="Rename" to_port="example set input"/>
             <connect from_op="Rename" from_port="example set output" to_port="example set"/>
             <portSpacing port="source_example set" spacing="0"/>
             <portSpacing port="sink_example set" spacing="0"/>
             <portSpacing port="sink_result 1" spacing="0"/>
           </process>
         </operator>
         <connect from_op="Retrieve Iris" from_port="output" to_op="Loop Attributes" to_port="example set"/>
         <connect from_op="Loop Attributes" from_port="example set" 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>

    Regards,
    Marco
  • gritsaygritsay Member, University Professor Posts: 12 University Professor
    Thnaks, it really good working.
Sign In or Register to comment.