if function with 3 clauses

felix_wfelix_w Member Posts: 59  Maven
edited November 2018 in Help

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 <3% --> 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



Best Answer

  • BalazsBaranyBalazsBarany Posts: 267   Unicorn
    Solution Accepted




    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







  • mschmitzmschmitz Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 2,030  RM Data Scientist


    the usual way i build this is:

    if( STORAGE < 3,
    "40% PULL",
    if( STORAGE > 51,
    "100% PULL" ,
    "50-60% PULL"


    - Head of Data Science Services at RapidMiner -
    Dortmund, Germany
  • felix_wfelix_w Member Posts: 59  Maven

    Thank you very much for your quick replies! Both of your solutions worked for me! :D 


    Best regards


Sign In or Register to comment.