• Resolved alnoman1969

    (@alnoman1969)


    Hi

    Cant get this to work?

    PREC(fieldname2*fieldname1*0.80)-(137300)-(fieldname2*fieldname1*0.80/12*3*0.7)

    This works fine, but then a want to divide this number with 12, can get that to work?

    Tryied

    PREC(fieldname2*fieldname1*0.80)-(137300)-(fieldname2*fieldname1*0.80/12*3*0.7)/12

    PREC(fieldname2*fieldname1*0.80)-(137300)-(fieldname2*fieldname1*0.80/12*3*0.7)/(12)

    Any suggestions?

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

    (@codepeople)

    Hello,

    The use of PREC in this case has no sense, the PREC operation requires two parameters.

    PREC(X,Y) rounds the number X with Y decimals.

    PREC(1.6547,3) = 1.655
    PREC(1.6547,2) = 1.65

    So, the correct structure of your equation would be:

    PREC(fieldname2*fieldname1*0.80-137300-(fieldname2*fieldname1*0.80/12*3*0.7)/12, 2)

    Please, for future tickets, include the link to the webpage where the form is inserted, because now I can check only the structure of the equation, but not the values of fields.

    Best regards.

    Thread Starter alnoman1969

    (@alnoman1969)

    Not working…site are nodesweden.se password 121612

    Thread Starter alnoman1969

    (@alnoman1969)

    The number are about 640.000 and then a want to divide it with 12. The number are about 640.000 and then a want to divide it with 12

    • This reply was modified 7 years, 1 month ago by alnoman1969.
    Plugin Author codepeople

    (@codepeople)

    Hello,

    I’ve checked your form, and the equation is working properly, the result corresponds to the equation you have implemented, another thing would be if you have not implemented the equation you want.

    Your current equation is:

    PREC(fieldname2*fieldname1*0.80-137300-(fieldname2*fieldname1*0.80/12*3*0.7)/12, 2)

    you divide with 12 only the second part of the operation (pay attention to the parentheses)

    For example, I will use the default values:

    fieldname1 = 600
    fieldname2 = 2000

    PREC(fieldname2*fieldname1*0.80-137300-(fieldname2*fieldname1*0.80/12*3*0.7)/12, 2) =
    PREC(2000*600*0.80-137300-(2000*600*0.80/12*3*0.7)/12, 2) =
    PREC(2000*600*0.80-137300-(2000*600*0.80/12*3*0.7)/12, 2) =
    PREC(960000-137300-(168000)/12,2) =
    PREC(960000-137300-14000,2) =
    PREC(808700,2) =
    808700.00

    and this last is the number that returns the equation in your form.

    If you want to apply the division by 12 to all the equation, you should use parentheses for grouping to all operands:

    PREC((fieldname2*fieldname1*0.80-137300-fieldname2*fieldname1*0.80/12*3*0.7)/12, 2)

    Best regards.

    Thread Starter alnoman1969

    (@alnoman1969)

    Tnx

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Divide’ is closed to new replies.