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

How can I use more than 1 conditions in an IF statement to create a new attribute?

scoopedscooped Member Posts: 1 Learner I
I use if(contains("SCOOP EGG",[subclass_english]),1,0) but I also want the result to come out to be 1 if there are other conditions like SCOOP EGG PAPER, PLANTS, BALLOONS within the same statement 

Answers

  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
    Hi!

    Generally, can use the && operator for a logical AND and || for a logical OR concatenation of your conditions.

    So the expression would be something like 
    if(contains(...) || contains(...) || contains(...), 1, 0)

    But if() in Generate Attributes has three parameters anyway, so you can put your conditions inside the if() if you want.

    if(contains(...), 1,
      if(contains(...), 1,
        if(contains(...), 1,
        0
        )
      )
    )

    Regards,
    Balázs
Sign In or Register to comment.