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

FormCalc mystery

NewsShmooze
Registered: Feb 13 2009
Posts: 24

I have a table with formCalc on each row.

The final column in each row is a total calculation of overtime costs. I want to add all of these final numbers together at the bottom.

The formCalc should be (a34+b34+c34+d34+e34+f34+g34+h34+i34) but for some reason, I keep getting the message that "a34 accessor is unknown". a34 is working fine in other calculations, so I removed a34 for trouble shooting and then it says "b34 accessor is unknown"

Am I missing something?

My Product Information:
LiveCycle Designer, Windows
jonom
Registered: Jan 31 2008
Posts: 133
I think you are missing the row number:
Row1.a34+Row2.b34 etc.

If you let LC number your rows automatically and leave the names of the cells the same you can use wildcards in the FormCalc:

ie: if your rows are auto-numbered Row1[0], Row1[1], etc. and you want to total a column with cells named "Total" you could use sum(Row1[*].Total[*])
NewsShmooze
Registered: Feb 13 2009
Posts: 24
I still can't get it...

All of the numbers in the boxes I want to add together are a calculations done after the user enters information. Is there something that says I can't add calculations together?

I feel like it should be so simple...
pforms
Registered: Nov 17 2009
Posts: 87
Try: Sum(a34,b34,c34,d34,e34,.........and so on)
NewsShmooze
Registered: Feb 13 2009
Posts: 24
That doesn't do it either...
jonom
Registered: Jan 31 2008
Posts: 133
Can you post your form somewhere?

I still think it's probably the row reference, but hard to say without seeing what you've done.
jonom
Registered: Jan 31 2008
Posts: 133
To get the proper path to the fields you need:

While in the script editor, place your mouse cursor where you want the reference to go. Then while holding down the CTRL key move the mouse cursor over the field you want to reference - the cursor should change to a "V" over a valid field - then left-click to insert the reference.

As I said above, I'm pretty sure you're missing the full path to the fields you are trying to reference. It should be along the line of table.row.field.

In Designer's help search on "To perform calculations in a table" and there's a diagram that explains what's going on.
NewsShmooze
Registered: Feb 13 2009
Posts: 24
I can definitely send you the form...just let me know where to post it.

I'm just stumped on this one! The rest of my calcs worked effortlessly! So frustrating...
jonom
Registered: Jan 31 2008
Posts: 133
You can create an account on acrobat.com and upload it there and then post the link in a message here.
NewsShmooze
Registered: Feb 13 2009
Posts: 24
https://acrobat.com/#d=4Vn8uKVCLkqntBhW-OUYlQ

Never done this before! Let me know if it works! Thank you so much for your help!
jonom
Registered: Jan 31 2008
Posts: 133
Ok, here you go!

The problem was the missing row numbers - your a34+b34+c34 should have been Row2.a34+Row3.b34+Row4.c34 etc.

I reworked your table to show how to use FormCalc and tables more efficiently - works out to much less typing for doing formulas. ;)

I did a few things...renamed your rows and cells to help with the calculations and tweaked some display patterns to not show zeros if there's nothing there (looks nicer). And I renamed the calculation fields so they're easier to work with - called "Total Hours" "TotalHours", etc. - makes things easier.

So now, the Total Hours field instead of a big long string of cell names being added together you have "1.5*(sum(a[*]))" and your Total Cost of Overtime is now "TotalHours*RateOfPay" and the total at the bottom is now "sum(Row3[*].TotalCost[*])".

https://acrobat.com/#d=GIDhcJ*VqbvJXfBO8olvWA
NewsShmooze
Registered: Feb 13 2009
Posts: 24
Ah! You're my favourite!! Thank you so much! As you can tell I'm new to this....and I know ZERO about java, so getting anything to work is a big deal! This isn't the first time you've come to my rescue though, so I REALLY appreciate it! Thanks again!
jonom
Registered: Jan 31 2008
Posts: 133
No problemo - and that's just FormCalc, JavaScript is another critter entirely. ;)

The advantage of using FormCalc on something like this is the ability to use wildcards - you can't do that with JavaScript.

Hopefully the row and cell naming makes sense so you see how the wildcards work with the row and cell instance numbers. If you needed to refer to a specific row and cell you would use the instance numbers - i.e. Row3[4].a[12] would get you the fifth instance of Row3 and the 13 instance of cell a.