Options

Can I pass macro in extract macro

sgnarkhede2016sgnarkhede2016 Member Posts: 152 Contributor II
edited August 2020 in Help
Hello,

I want to pass attribute name dynamically as loop iteration like in 1st iteration in "attribute name" is "attribute_1" in second "attribute_2" and so on.

when i checked in generate attribute this macro gives correct result what i want "SCENARIOPARAMETER_"+%{iteration}" but same when i passed in extract macro giving error " attribute not present in input data" and hardcoded workling
Tagged:

Answers

  • Options
    MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,508 RM Data Scientist
    Hi,
    i guess you want to use the attribute function. to access the value of attribute_%{iteration} you usually do

    attribute("attribute_"+%{iteration})
    There are some more things you can do with the # notation instead of %, but i always forget them and need to ask @David_A

    Best,
    Martin
    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • Options
    David_ADavid_A Administrator, Moderator, Employee, RMResearcher, Member Posts: 297 RM Research
    Hi,

    the attribute() function is exactly the thing you're looking for. It will resolve the macro value first and and then looks the combined string as an attribute name.  With the # you could basically do the same, but the function is the more readable approach.

    Best,
    David
Sign In or Register to comment.