• Resolved KingJayded

    (@kingjayded)


    Hi,

    Hoping someone can help me with this Java code snippet. I have a calculated form field in which I am trying to ensure that the end result is divisible by 4. No matter how I code it nothing seems to work? Any ideas?

    (function(){
    var temp = fieldname10;
    if(fieldname3 == 12) { return fieldname10; }

    if (fieldname3 == 24) {
    if (fieldname10 % 2 == 0) { return fieldname10;}
    else {return fieldname10+1;}
    }

    if (fieldname3 == 48) {
    while (fieldname10 % 4 != 0) {temp+1;}

    }

    })();

Viewing 1 replies (of 1 total)
  • Thread Starter KingJayded

    (@kingjayded)

    Sorry guys, managed to fix it:

    (function(){
    var temp = (fieldname10);
    var result = 0;

    if(fieldname3 == 12) { return fieldname10; }

    if (fieldname3 == 24) {
    if (fieldname10 % 2 == 0) { return fieldname10;}
    else {return fieldname10+1;}
    }

    if (fieldname3 == 48) {
    while (temp % 4 != 0) {temp +=1;}
    return temp;
    }

    })();

Viewing 1 replies (of 1 total)
  • The topic ‘Calculated Form Fields – Java Code Issue’ is closed to new replies.