[b]Really, I'm just asking for confirmation and/or to be corrected:[/b]
Say I've a form that a user created. It's 10 columns, 30 rows.
I created the first row's fields (some text, some combo boxes) with simple names (A, B, C, etc.) I then selected all the fields and used the Create Multiple Fields command to replicate these fields down the 30 rows.
[b]Here's the part where I get annoyed and where I think someone can tell me if I can't have my cake and eat it too:[/b]
Because I've created hierarchical fields (A encompasses A.0, A.1, A.2, etc.) I can use the preset calculation feature in a "total1" field that I've created elsewhere on the same page to simply calculate all fields A (again, A.0, A.1, A.2, etc.)
Remembering that this was all created [i]by[/i] Acrobat, my problem lies when I want to perform calculations [i]across[/i] columns and use the Simplified Field Notation (SFN) to calculate a row (A.0, B.0, C.0, etc.) by entering:
A.0+B.0+C.0
in the SFN JavaScript Editor and the calculation field remains empty -- signifying to me that there's an error. Later on, I will intend to use more-complex calculations, e.g.:
(A.0*5)+(B.0*20)
which I realize works fine if my fields weren't named with a period in the field-names, e.g.:
(A0*5)+(B0*20)
Am I wrong to want such things or am I just creating buggy code? I thought I was being so-very-careful with my programming too!
[b]To restate: Are all these below statements true?[/b]
1. Using hierarchical field names (i.e., names which start with a letter but contain a period followed by a number) is acceptable for calculations if I were to use ONLY the presets (sum, product, average, minimum, maximum) and selecting field names' check boxes.
2. Using hierarchical field names will [b]not[/b] work when attempting to use SFN.
3. I'm probably much better off just renaming all my fields and renaming them without a period and just use SFN (I'd prefer not to use JavaScript if I don't have to.) But this also means a more time-consuming time for me and those like me.
If there's a more elegant / better solution that won't make my brain fall out, I'm open to suggestion(s)! [i]Doctor, is there nothing I can take? I say, doctor, to relieve this calculation ache![/i]
Since you want to do calcualtions on both colums and rows you are no longer doing simple work. And you've got a lot of rows and columns. What are you going to do if you have to make changes later on? This could be very time consuming.
The solution is to use JavaScript. With proper naming(exactly what you are already doing) and JavaScript you can create generic fucnctions (i.e. independant of a specific row or column) to do your calculations. This is much more elegant than the brute force approach of putting individual calcualtions on each row and column, and much easier to maintain.
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script