rsheldon Posted December 23, 2013 Share Posted December 23, 2013 I am using FusionPro 9.0.3 in Acrobat 10.1.8 on the Mac running OS 10.8.5. I am trying to use the math function to round up an entry in my database to the nearest $5 amount (i.e., $6.00 to $10.00) I need help writing a rule to do this. The second part of the equation is to take the same number (i.e., $6.00) multiply this by 1.5 and then round up to the nearest $5.00 amount (i.e., $6.00 x 1.5 = 9.00, but needs to equal $10.00) Quote Link to comment Share on other sites More sharing options...
David Miller Posted December 23, 2013 Share Posted December 23, 2013 (edited) If I understand your question correctly, I think this might work. Math.ceil rounds up, Math.floor rounds down and Math.round rounds to the nearest integer. You may need to adjust this. Part 1: I am trying to use the math function to round up an entry in my database to the nearest $5 amount (i.e., $6.00 to $10.00) I need help writing a rule to do this. return Math.ceil(Field("Number")/5)*5; Part 2: The second part of the equation is to take the same number (i.e., $6.00) multiply this by 1.5 and then round up to the nearest $5.00 amount (i.e., $6.00 x 1.5 = 9.00, but needs to equal $10.00) var x = (Field("Number")*1.5) return Math.ceil(x/5)*5; Edited December 23, 2013 by David Miller Quote Link to comment Share on other sites More sharing options...
rsheldon Posted December 26, 2013 Author Share Posted December 26, 2013 Good Morning David, Thank you ever so much for your reply. I have created a rule based off of the function you posted and everything seems to be working great. You hit the nail right on the head. It is a wonderful thing being able to post to this forum knowing someone out there has encountered the same issues you have and their willingness to share their solutions. Thank You again, Rob Sheldon Quote Link to comment Share on other sites More sharing options...
rsheldon Posted February 26, 2015 Author Share Posted February 26, 2015 I need to know if we can round up or down based on the decimal for another job now. Can someone please let me know? i.e., $10.02 to $10 or $10.50 to $11. Quote Link to comment Share on other sites More sharing options...
David Miller Posted February 26, 2015 Share Posted February 26, 2015 (edited) I need to know if we can round up or down based on the decimal for another job now. Can someone please let me know? i.e., $10.02 to $10 or $10.50 to $11. var x = Field("Number") return Math.round(x); or return Math.round(Field("Number")); Edited February 26, 2015 by David Miller Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.