Expand my Community achievements bar.

Help with simple addition formcalc issue

Avatar

Level 2

I know just enough to be dangerous. I'm trying to get a row in a table to add up and appear in a separate subtotal box. The error I get is "accessor amount [*] unknown." I am working from the invoice template, but I had to refigure the box after some issues. I am using the formula that appeared in the previous subtotal box, but I know I'm not referencing the table row properly.

Each amount box has been given a name (amount1, amount 2, etc) in the binding box and the subtotal box formula I used (throught formcalc) is form1.#subform[0].Subtotal::calculate - (FormCalc, client)
Sum(Table1.Row1-15.amount[*])

and

Sum(amount1, amount2, amount3, amount4...) (listing all the amount names up to 15)

I also tried Sum(amount[*]) as the previous template did and it wouldn't work. The Subtotal box grouping is straight from the Invoice Template, not created from the table. I know I am missing something pretty basic with heirarchy, but I don't know enough about scripting to figure this out. Any help (and explanation of what I did wrong) would be greatly appreciated. Thanks!

6 Replies

Avatar

Level 10

The accessor [*] is only used for objects with the same name, that occur once or more.

If you have 5 fields "Amount" in one row named "Row1" then the reference syntax is

Table1.Row1.Amout[0], Table1.Row1.Amout[1] ... Table1.Row1.Amout[4].

If you have 5 rows named "Row1" and each row has one field "Amount" then the reference syntax is:

Table1.Row1[0].Amout, Table1.Row1[1].Amout ... Table1.Row1[4].Amout

Both examples only work if the object that is repeated has always the same name!

Avatar

Level 2

When I first tried that ("amount" as the name in the binding area), it wouldn't work but I don't think I listed the heirarchy correctly. I did get the form to add up just row 1 when I put in Sum(Table1.Row1[*].amount) with no error message.

So you are saying I need to write out Table1.Row1.amount, Table1.Row2.amount, etc, through 15 to get the answer? There is no easier way to get all 15 cells to add up?

There are 15 rows downs, eight cells across, the last being "amount". When I try Sum(Table1.Row [*].amount) I get the accessor unknown error again.

Thanks for your help! I appreciate your explanation.

Avatar

Level 2

So, I wrote it out long hand and it worked. My question is: is the an easier way to do this? How do I use the [*] to help with that? Didn't seem to work when I tried Sum(Table1.Row[*].amount).

Avatar

Level 10

If you can share your form.

I believe you're trying to access instances of a table rows which aren't applied dynamically to the form.

But to determine this I have to able to look at it.

Avatar

Level 2

It's fine. It worked writing it out. For future reference, how exactly do I attach the form to this? I don't see a "paperclip" to attach a document.

Avatar

Level 10

You can upload you file to any file sharing service such as http://acrobat.com/ and post the link in the thread.