I am trying to complete a mileage reimbursement form. I think I have a good design (?) but I am missing a critical efficiency within the form. I want the form to be able to calculate the cost centers across the expandable table within the subform. I have a dropdown that has different cost centers. How would I be able to sum like cost centers within the expandable table? Can I populate another table with just the totals for a particular cost center by calculation? I would need this for all cost centers This would help out the accounting department as the mulitple cost centers would be added.
My first page is expandable to accomodate multiple rows and has a page total and a grand total that floats if more rows are needed. My second page is more or less just for accounting I have a seperate table that right now is manually completed. The clerk has to printout the form and then manually add each cost center and then add it to the table on the second page.
I have tried to just use a numeric field on the second page attempting to get the calculations based of the test entry in the cost center of Edit. It only places the data of the first entry and does not cycle through and capture all cost centers in the expandable table that are Edit. Any help in the code and ideas on how to present the total in a new table would be greatly appreciated.I am a beginner at this and am trying to learn and complete this on my own but I am not sure what to do. Attached is my form.
http://aaa9.org/Updated%20Employee%20Mileage%20Expense%20Form.pdf
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Looks like me and Jono were looking at this at the same time. I put the summary in another table is probably the only real difference, but having made a sample I thought I might as well share it, https://acrobat.com/#d=ltESj1zx3bk1GP9baTdv2g. Have a look at the code in the form1.SummaryTable calculate event.
Hope it helps
Bruce
Views
Replies
Total Likes
The following JavaScript will loop through the table and total up according to what is selected in the dropdown list. Put it on the Calculate event of a numeric field.
You'll need a separate field for each category and you'll need to update the rawValue test to the appropriate number for each field (I started with 2 because your first entry, which is 1 is blank). Depending where you put the fields you'll need to update the path to "Table1".
var nTotal = 0;
for (var i=0; i < Table1._Item.count; i++){
if (xfa.resolveNode("Table1.Item[" + i + "].DropDownList2").rawValue == 2){
nTotal ++;
}
}
this.rawValue = nTotal;
Couple of tips:
You've got an extra subform on your "page 3", you've wrapped one subform with another which isn't needed.
It's important to name your subforms, especially when scripting.
Hi,
Looks like me and Jono were looking at this at the same time. I put the summary in another table is probably the only real difference, but having made a sample I thought I might as well share it, https://acrobat.com/#d=ltESj1zx3bk1GP9baTdv2g. Have a look at the code in the form1.SummaryTable calculate event.
Hope it helps
Bruce
Views
Replies
Total Likes
So was I. I wanted to help out with this one because I JUST got finished creating a similar form that had me pulling my hair out.
https://acrobat.com/#d=au6Ak9oa4nwMoa3BvRhvcw
But I like BR001's better because you don't have that extra page added as it is in mine.
Jo
Bruce,
Thank you so much as I was about to give up! Everyone I thank you for the assistance. This is board is one valuable resource with many experts!
Views
Replies
Total Likes
That's slick Bruce!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies