• Resolved soenke22

    (@soenke22)


    Hallo,

    I would like to offer readers the opportunity to solve the following formula with input (number fields):

    This is my equation:

    1,15 · (M – (a + b · M + c · Y) ·Y) Euro

    values for a, b, c:

    if fieldname1 = 1 -> a = 0,04, b = 0,0004991, c = 0,00004620

    if fieldname1 = 2 -> a = 0,03, b = 0,0003716, c = 0,00003450

    if fieldname1= 3 -> a = 0,02, b = 0,0003716, c = 0,00002780

    if fieldname1 = 4 -> a = 0,01, b = 0,0003035, c = 0,00002000

    if fieldname1 = 5 -> a = 0,00, b = 0,0002251, c = 0,00001950

    values for M and Y:

    M = rent = fieldname3 (200 – 2500 €)

    Y = monthly income = fieldname 4 (700-4000 €)

    number of people = fieldname1 (1 – 5 people)

    level = fieldname2 (7 levels)

    rent = fieldname3 (200 – 2500 €) = M

    M must be limited if the number of people and the rent (in different regions – fieldname2) exceed certain values – otherwise fieldname3 can be adopted:

    if fieldname1 = 1

    and fieldname2 = 1 and fieldname3 >= 347 take 347

    and fieldname1 = 2 and fieldname3 >= 392 take 392

    and fieldname2= 3 and fieldname3 >= 438 take 438

    4

    5

    6

    7

    if fieldname1 = 2

    and fieldname2= 1 and fieldname3 >= 420 take 420

    and fieldname2= 2 and fieldname3 >= 474 take 474

    3

    4

    5

    6

    7

    if fieldname1= 3

    and fieldname2= 1 and fieldname3 >= 501 take 501

    and fieldname2= 2 and fieldname3 >= 564 take 564

    3

    4

    5

    6

    7

    fieldname1= 4

    else if fieldname3 < if-statements above (347, 392, 438, 420, 474, …) take fieldname3

    Is there a way to do this?

    Thanks for help!

    Soenke

    • This topic was modified 8 months ago by soenke22.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @soenke22,

    I’m sorry, I don’t understand all your description but yes, you can implement the formula using our plugin.

    Something like (Note the decimal symbol is represented by a point, not the comma, and the symbol for equality is the double equal “==”):

    
    (function(){
        var a, b, c, M = fieldname3, Y = fieldname4;
    
        if(fieldname1 == 1) { 
            a = 0.04; 
            b = 0.0004991; 
            c = 0.00004620;
    
        } else if(fieldname1 == 2) { 
            a = 0.03;
            b = 0.0003716;
            c = 0.00003450;
    
        } else if(fieldname1 == 3) {
            a = 0.02;
            b = 0.0003716;
            c = 0.00002780;
    
        } else if(fieldname1 == 4) {
            a = 0.01;
            b = 0.0003035;
            c = 0.00002000;
    
        } else {
            a = 0;
            b = 0.0002251;
            c = 0.00001950;
        }
        return 1.15 * (M - (a + b * M + c * Y) * Y);
    })()

    Please note the plugin support does not cover implementing the users’ projects. If you need someone that implement your equations, you can contact us directly through the plugin websites. Contact Us.

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘how to if-conditioins in equation’ is closed to new replies.