I have a form that multiplies the number of items by $6.07 but I need the total to round up to the nearest dollar. I have formatted the total field to be integer and selected integer in the binding tab, which works to drop the cents out of the total but that doesn't help it round up. I suspect a script is needed to accomplish this. How do I write this script?
Thanks for your help.
Hi,
In JavaScript you can use the toFixed method of the number object to round to an whole number. So if variable total had a value of 10.5 then total.toFixed() would give you 11.
One catch is that toFixed() returns a string value so it might not format exactly how you expect, so
parseInt(total.toFixed())
Will return a number value.
Regards
Bruce
Thank you!!!!!
Date: Mon, 11 Jun 2012 16:14:20 -0600
From: forums@adobe.com
To: jeanetteeichhorn@hotmail.com
Subject: Re: How do I round up a total to the nearest dollar? How do I round up a total to the nearest dollar?
Re: How do I round up a total to the nearest dollar?
created by BR001 in LiveCycle Designer - View the full discussion
Hi, The FormCalc equivilant is the Round function, so; Round(Table2.Row8.Eight * 6.07, 0) With the second parameter to Round being the number of decimal places, which defaults to zero so in this case you could just write; Round(Table2.Row8.Eight * 6.07) Regards Bruce
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Re: How do I round up a total to the nearest dollar?
To unsubscribe from this thread, please visit the message page at Re: How do I round up a total to the nearest dollar?. In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in LiveCycle Designer by email or at Adobe Forums
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.
You will want to use the Ceil function instead, which returns the next whole number greater than the expression, so;
Ceil(Table2.Row8.Eight * 6.07)
Just note that this will only for positive numbers, if you have to deal with negative numbers (maybe a refund) then you will need to use the Floor function.
Regards
Bruce
Ok, I will try this on my form and let you know how it went. Thanks so much for your continued support.
Date: Tue, 12 Jun 2012 16:12:57 -0600
From: forums@adobe.com
To: jeanetteeichhorn@hotmail.com
Subject: Re: How do I round up a total to the nearest dollar? How do I round up a total to the nearest dollar?
Re: How do I round up a total to the nearest dollar?
created by BR001 in LiveCycle Designer - View the full discussion
You will want to use the Ceil function instead, which returns the next whole number greater than the expression, so; Ceil(Table2.Row8.Eight * 6.07) Just note that this will only for positive numbers, if you have to deal with negative numbers (maybe a refund) then you will need to use the Floor function. Regards Bruce
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Re: How do I round up a total to the nearest dollar?
To unsubscribe from this thread, please visit the message page at Re: How do I round up a total to the nearest dollar?. In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in LiveCycle Designer by email or at Adobe Forums
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.
North America
Europe, Middle East and Africa
Asia Pacific