• Resolved justin_19

    (@justinsmith19)


    Hi @codepeople,

    I am trying to limit these functions to 2 decimal places.
    I have used the PREC(),2) in various ways but can’t seem to get it right.

    Below is the function I would like to limit to 2 decimal places:

    (function(){
    
    if(fieldname1 == 100) return 0.20*fieldname2;
    if(fieldname1 == 200) return 0.39*fieldname2;
    if(fieldname1 == 300) return 0.60*fieldname2;
    if(fieldname1 == 400) return 0.78*fieldname2;
    if(fieldname1 == 500) return 0.98*fieldname2;
    
    })()

    I would really appreciate your help once again.
    Thanks

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

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

    (@codepeople)

    Hello @justinsmith19

    Please, edit the equation as follows:

    
    PREC((function(){
    
    if(fieldname1 == 100) return 0.20*fieldname2;
    if(fieldname1 == 200) return 0.39*fieldname2;
    if(fieldname1 == 300) return 0.60*fieldname2;
    if(fieldname1 == 400) return 0.78*fieldname2;
    if(fieldname1 == 500) return 0.98*fieldname2;
    
    })(), 2)
    

    Best regards.

    Thread Starter justin_19

    (@justinsmith19)

    Ahh! Thanks so much @codepeople

    Your support is outstanding!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Limit function to 2 decimal places’ is closed to new replies.