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

Calculating fields

mclausen
Registered: May 3 2010
Posts: 6

I'm creating a form that calculates leave for employees. I have created 2 fields, "hours" and "reason". The user will enter there leave hours in the first field, then select a reason ( Sick, Vac, PBl,....).

There are 31 boxes of each, one for each day, then the totals area auto calculated and placed in the total fields for each different type of leave.

I have drop down boxes for the "reason" and have item values specified in binding. I'm using == to the binding number to specify the type of "reason".

I can get the individual fields to total in the final total area, but have been unable to add two "hours" fields together to get a combine total for the two days.

Example: Joe takes off on Monday for 4 hours PBL, then on Tuesday he takes 2 hours PBL. I need both days added together and totaled at the bottom of the page.

Matt Clausen

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
You may have to read each day's 'reason' combo box and then add the value of the hours to the appropriate variable bucket and then set the total for each 'reason' by the accumulated variable bucket for each reason.

George Kaiser

mclausen
Registered: May 3 2010
Posts: 6
Here is my IF statement:

IF (form1.reason [0] == 2) then ((form1.hours [0] + form1.sick)+sicktotal) elseif (form1.reason [1] == 2) then ((form1.hours [1] + form1.sick)+sicktotal) endif

I created a variable called "sicktotal" to be the var bucket and in my script try to add the hours to the sicktotal.

It does not work. Could you give me a point in the right direction?

Thanks,
Matt

Matt Clausen

--SID--
Registered: May 4 2010
Posts: 31
if the values are in fields, then you can simply use arithmetic script:

field3.rawValue = field1.rawValue + field2.rawValue

and you can apply this on calculate event of the field3, which is the totalling field

~~ S I D ~~