Print Page | Close Window

Whole number without rounding...

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: JavaScript
Forum Description: Discussions relating to the use of JavaScript within PDF.
URL: http://forums.planetpdf.com/forum_posts.asp?TID=1425
Printed Date: 21 Sep 2019 at 6:03am
Software Version: Web Wiz Forums 11.10 - http://www.webwizforums.com


Topic: Whole number without rounding...
Posted By: RaeEveMay
Subject: Whole number without rounding...
Date Posted: 28 Jan 2015 at 8:20pm
I need to get the value of a field "LOAN_AMT" that is a numeric field with two decimals and convert that into a new field "LOAN_AMT_NO_CENTS" that does not round. This is the problem I am having:

LOAN_AMT=15.75
LOAN_AMT_NO_CENTS pulls in 16 instead of 15. 

I basically just need to truncate the cents off of the amount.

I know this does not make sense most forms would require you to show 16 in the example above but that's the Federal Government for you! These new forms are a nightmare!

Any advice is greatly appreciated.

Thank you,

Rae



Replies:
Posted By: try67
Date Posted: 28 Jan 2015 at 11:31pm
Use this code as the custom calculation script of LOAN_AMT_NO_CENTS:
event.value = Math.floor(+this.getField("LOAN_AMT").value);


-------------
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com


Posted By: RaeEveMay
Date Posted: 29 Jan 2015 at 7:09pm
Thank you! That worked like a charm! 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 - http://www.webwizforums.com
Copyright ©2001-2017 Web Wiz Ltd. - https://www.webwiz.net