• Resolved civilvicky

    (@civilvicky)


    could you plz help me to fix the formula,

    Fieldname1 (number field)

    Formula should be,
    If the fieldname1 value is between 1 to 90 then fieldname1+0,
    If the fieldname1 value is between 91 to 180 then 180-fieldname1,
    If the fieldname1 value is between 181 to 270 then fieldname1-180,
    If the fieldname1 value is between 271 to 360 then 360-fieldname1,
    If the fieldname1 value is between 361 to 450 then (fieldname1-360)+0,
    If the fieldname1 value is between 451 to 540 then 180-(fieldname1-360),
    If the fieldname1 value is between 541 to 630 then (fieldname1-360)-180,
    If the fieldname1 value is between 631 to 720 then 360-(fieldname1-360),

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

    (@codepeople)

    Hello @civilvicky

    Thank you very much for using our plugin.

    The preferred solution would be to implement the equation with function structure:

    (function(){
    if(fieldname1) return;
    if(fieldname1<=90)  return fieldname1;
    if(fieldname1<=180) return 180-fieldname1;
    if(fieldname1<=270) return fieldname1-180;
    if(fieldname1<=360) return 360-fieldname1;
    if(fieldname1<=450) return fieldname1-360;
    if(fieldname1<=540) return 180-(fieldname1-360);
    if(fieldname1<=630) return (fieldname1-360)-180;
    if(fieldname1<=720) return 360-(fieldname1-360);
    })()

    There are some of the operations that have no sense, like:

    360-(fieldname1-360) because it is equivalent to -1*fieldname1

    Best regards.

    Thread Starter civilvicky

    (@civilvicky)

    Its not working, have a look.

    https://calculatorhub.org/?cff-form=87

    Plugin Author codepeople

    (@codepeople)

    Hello @civilvicky

    I’m sorry, my fault. Please, edit the line of code:

    if(fieldname1) return;

    as follows:

    if(!fieldname1) return;

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘help regarding formula’ is closed to new replies.