Options

"Loop Attributes - Expression Evaluation Error"

1705410G1705410G Member Posts: 43 Contributor I
edited May 2019 in Help
I'm using 2 separate Loop Attributes Operator, each containing a Generate Attribute Operator.

Attribute Name(Inside Generate Attribute) for both Loop Attributes Operator: %{loop_attribute}


However, this error popped out. 
Expression Evaluation Error: The function 'eval' failed to parse the subexpression '203_10'. Cause: token recognition error at '_'  .
Initially, I thought that by removing the underscore '_' will solve it. But no matter what I did to rename it using the Rename by Replacing operator, it doesn't work. Same error comes up.



Sometimes, the Not Enough Iterations Error  pops up as well. I'm confused when I have set the Loop Attribute to subset and have selected the necessary attributes. 

Regards,
AY

Best Answers

Answers

  • Options
    1705410G1705410G Member Posts: 43 Contributor I
    edited January 2019
    HI David_A 

    #{loop_attribute} syntax worked!! Thank you!! But the results seems wrong

    As mentioned above, i'm using 2 separate Loop Attributes operator.

    Attribute filter type is set to subset with about 40 different attributes selected in each Loop Attributes operator. 
     

    However, there's only 1 column of results produced by the first loop and s
    econd loop (Shown below). Does it means that both Loop Attributes only loop once?  
      


    My question is how can I allow the 2 different loops to loop for all selected attributes?
    So I should be able to get 80 new columns in total. 40 for the first loop function and 40 for the second loop function.  

    P.S. How do I get the loop attributes to use back the same name rather than #{loop_attribute} since I have 40 over attributes in each Loop Attribute operator?


    Thank you!! 

    Regards,
    AY
  • Options
    1705410G1705410G Member Posts: 43 Contributor I
    Hi 

    It worked! Thank you so much to all that contributed!


  • Options
    kypexinkypexin Moderator, RapidMiner Certified Analyst, Member Posts: 291 Unicorn
    In that case you need to use the seldom used #{loot_attribute} syntax. This returns the value corresponding to that attribute name.

    @David_A -- thanks for that secret knowledge, it took me an hour of my life to struggle with Loop Attributes before I have found this solution on the forum!

    PS one more proof how really useful and helpful RM community can be! MAGIC!
  • Options
    MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,520 RM Data Scientist

    i am quite close to write a getValueOf(String attribute) function and add it to the expression parser. I got the feeling that this would fix this hazzle.

    BR,
    Martin
    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • Options
    kypexinkypexin Moderator, RapidMiner Certified Analyst, Member Posts: 291 Unicorn
    @mschmitz -- would be great!

    '#{macro}' notation is basically okay (if you know about it of course :) ), but having getValueOf(String attribute) would simplify the process structure in some cases. 
Sign In or Register to comment.