if function with 3 clauses
Dear Rapidminer Community,
I would like to build an if function via generate attributes but I have a problem because I have more than two "answers" to my if clause.
What I tried to build is this (look at the bottom) but it didn't work because the "||" operator expects a numeric or boolean type which I dont have, I have real. Furthermore, I can't fit all the clauses in one if statement right? Because I have 3 options to fulfill:
if Storage % --> 40% pull
if Storage >= 51% --> 100% pull
if Storage >=3% && <=50% --> 60% pull
Is there any possibilty to solve this?
(if([Füllstand]<=0.02, 0.4*Einlagerleistung, "")) ||
(if([Füllstand]>=0.51, Einlagerleistung, "")) ||
(if([Füllstand]>=0.03 && [Füllstand]<=0.5, 0.6*Einlagerleistung, ""))
I hope it's clear what I want to do.
Best regards
Felix
Best Answer
-
BalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
Hi,
it's usually easier to nest the if()s.
if([Füllstand] <= 0.02, 0.4 * Einlagerleistung,
if([Füllstand] >= 0.51, Einlagerleistung,
0.6 * Einlagerleistung
)
)
Regards,
Balázs
2
Answers
Hi,
the usual way i build this is:
Dortmund, Germany
Thank you very much for your quick replies! Both of your solutions worked for me!
Best regards
Felix