Can I pass macro in extract macro

sgnarkhede2016sgnarkhede2016 Member Posts: 136 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

  • mschmitzmschmitz Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,233 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
    - Head of Data Science Services at RapidMiner -
    Dortmund, Germany
    David_A
  • David_ADavid_A Administrator, Moderator, Employee, RMResearcher, Member Posts: 284 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
    mschmitz
Sign In or Register to comment.