These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Calculation question - new to this

clydesnodgrass
Registered: Mar 17 2010
Posts: 6

Have a form that I've created that has 99% of the fields calculating just fine (mainly because they are all sums of othe fields)... HOWEVER. I need to caluclate the yearly monthly expenses of someones mortgage.

IE: After inputting all the info in the current monthly expense fields, that auto sums in the "total payments" box. I need to then calculate what the yearly mortgage expense is. So "total payments*12"

I have NEVER programed anything in Java and aren't sure I want to learn for three calculations that I need help on... but I'm willing to give it a try.

Besides doing that for three different 'cells', I also need to calculate the monthly savings of the 'before' payment compared to the 'after' payment.

So it would be "total current monthly expenses - proposed monthly expenses"... and that's it really.

Not sure where to start, if I'm supposed to literally spell out the tooltips in the field for the advanced calculations, which is why I'm here.

I'm new to the forum, but seems you guys have a LOT of good info and I apologize LONG in advance if there is a thread on this. I did a search, but to be honest, I can't find something that applies exactly to what I'm asking about and can't sit in my office searching a forum (that has to wait until I get home).

Thanks guys.

My Product Information:
Acrobat Standard 9.2, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
You may want to start looking at the tutorials, articles, and eSeminars on demand to develop some basic sense about Acrobat JavaScirpt and see links to additional documentation.

George Kaiser

clydesnodgrass
Registered: Mar 17 2010
Posts: 6
I did that, thanks! Apparently I was just reading into the calculations more than I should... I thought, like Excel, you had to know the exact position of the data you were looking to calculate, as oppossed to just using the names of the data field themselves in the calculation, so I got everything to calculate right.

However. I am now getting errors in the three fields that have the calculations. They work fine, but three pop up boxes show up, one after another, telling me that "the value entered does not match the format field [current LTV] with "current LTV" being one of the three fields that I put the calculations in.

Upon opening the form, all three fields have "0.0%" in them, which is what it should say as there isn't any data in the other fields, however, the people that are going to be using this field are going to get very confused when they get an error and instead of just clicking "okay" they will not even use the form.

I'm sure there is an easy workaround, yes?
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You should post the code or the file. You probably made a mistake somewhere.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

KathyMP
Registered: Mar 29 2010
Posts: 6
I am a complete novice. I have read numerous articles to try to get the answer to my query and feel more confused than when I started... I feel overwhelmed by Java Script!

I am trying to create a calculation in an Acrobat 9.0 form which works out the installment payment dates based on an inception date, the number of agreed payments and the overall time period. i.e.
DueDate1 = "if Payments is more than 0, then add Calc1 [which is number of days between installments] to Inception else leave this field blank".
DueDate2 = if Payments is more than 1, then add Calc1 to DueDate1 else leave this field blank".
Etc. up to DueDate11

Based on one article I saw, I put in the following in my DueDate1 field:

var nPayments = this.getField("payments").value;
if( nPayments > 0)
event.value = nCalc1 + nInception;
else
event.value = 0;

Absolutely nothing happens.

Payments = the number of installments that will be paid and is formatted as a number
Months = how long the Installment agreement will last
Calc1 = is the result of Payments / Months * 30 to give me how much time to add to each installment date and is formatted as a number
Inception = the start date of the Installment plan, the date the deposit is paid and is formatted as a date.
DueDate1 = where I want to calculation to happen and is formatted as a date

Because there is a date involved and I'm adding a number to it to get a new date, do I need to change the date to milliseconds?

Help!

Kathy

try67
Expert
Registered: Oct 30 2008
Posts: 2398
Maybe you should post you entire code. It's possible there's an error somewhere else.
Also, where is this script placed?

I would put curly brackets around the if-else statements, like so:
if (condition) {... do something} else {... do something else}

To answer your last question: What does the number represent? But yes, the best way is to convert it to milliseconds.

Edit: Also, you should have started a new thread instead of piggy-backing this one...

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

KathyMP
Registered: Mar 29 2010
Posts: 6
I'm really showing my 'green-ness'. I too thoguht that would be most appropriate but I couldn't see where to start a new thread. Can you help with that to start me off on the right track?

Kathy

try67
Expert
Registered: Oct 30 2008
Posts: 2398
Go to the the JavaScript forum: http://www.acrobatusers.com/forums/aucbb/viewforum.php?id=25
and click on Post new topic (upper right corner, above the list of topics).

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com