• Resolved spiritxanas

    (@spiritxanas)


    var temp = 0;

    IF ( SUM(fieldname21, fieldname22, fieldname23, fieldname24) < -4, temp = -4, temp = SUM(fieldname21, fieldname22, fieldname23, fieldname24) )

    IF( SUM(fieldname15,fieldname16,fieldname17,fieldname18,fieldname19,fieldname20, temp) <= 20,

    IF(fieldname20 == 0,”Your L1R4 Points -> ” + (SUM(fieldname15,fieldname16,fieldname17,fieldname18,fieldname19,fieldname20, temp)), “Your L1R5 Points -> ” + (SUM(fieldname15,fieldname16,fieldname17,fieldname18,fieldname19,fieldname20, temp)) ), “Sorry, You did not make it to JC, Your Points -> ” + (SUM(fieldname15,fieldname16,fieldname17,fieldname18,fieldname19,fieldname20, temp)) )

    I’m trying to do the above in a calculated field box, but when I add the temp and first IF, the output is blank. When I remove these lines, the output seems to work, I basically want to add the Temp variable in the output and sum below but the output is always blank. I’ll make variables for the sum later but gotta make it work now

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @spiritxanas

    You have two alternatives:

    * You can nest IF operations,

    * Or you can implement the equation with a function structure and use the if conditional statements. I prefer the second alternative because it is more readable.

    I’m checking your code, but unfortunately, the parser errors do not allow me to understand all your calculations.

    I guess you tried to implement the following equation:

    (function(){
        var temp = MAX(-4, SUM(fieldname21, fieldname22, fieldname23, fieldname24)),
            result = SUM(fieldname15,fieldname16,fieldname17,fieldname18,fieldname19,fieldname20, temp);
        if( resul <= 20)
        {
            if(fieldname20 == 0) return "Your L1R4 Points -> "+result;
            return "Your L1R5 Points -> "+result;
        }
        return "Sorry, You did not make it to JC, Your Points -> "+result;
    })();

    Best regards.

    Thread Starter spiritxanas

    (@spiritxanas)

    BRO THANK YOU SO MUCH, I CANT EVEN EXPRESS HOW RELIEVED I AM
    I was trying the nested IF which made it all messy you’re right, the function method works flawlessly, I forgot we could have multiple return points from a function, thanks again man

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using multiple IF leading to Blank Output’ is closed to new replies.