Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

FormCalc calculations for dynamic table with expanding columns

Avatar

Level 2

Hi All,

I have a form that I'm building where the table expands by columns and not rows. I have the instances set up and the columns are added or removed by the user with no problems. What I want to do is have a column that subtitles each row. I know how to do subtotals when I'm working with tables that expand by rows, but the FormCalc doesn't translate to the column.

I used this as a reference to build the expanding columns: http://forms.stefcameron.com/2006/10/28/scripting-table-columns/

All the cells for the dynamic column are set up as subforms (ColX). Then the numeric fields are added to the subform. Add/Delete column buttons scripting:

[ADD}

Table1.HeaderRow._ColX.addInstance(0);

Table1.Row1._ColX.addInstance(0);

Table1.Row2._ColX.addInstance(0);

Table1.Row3._ColX.addInstance(0); //...etc. for as many rows as needed

[DELETE]

var nCount = Table1.HeaderRow._ColX.count;

if (nCount > 1)

{

Table1.HeaderRow._ColX.removeInstance(nCount - 1);

Table1.Row1._ColX.removeInstance(nCount - 1);

Table1.Row2._ColX.removeInstance(nCount - 1); //...etc. for as many rows as needed

}

What I need the table to do is this:

Numeric FieldNumeric Field (+/-)Subtotal
AB...Z (multiple columns)A + (B...Z)
sum(column)Sum(column)sum(columm)

I've tried some variation of the following with every combination of [*] thrown in there.

$.rawValue =  Sum(Row#.ColX.Cell# + Row#.Cell1)

3 Replies

Avatar

Level 2

I've got the row subtotal to work

$.rawValue =  Sum(Sum(Row3[*].ColX[*].Cell4[*]) + Row3.Cell3)

Still need a formula that totals the column when it is one of the dynamically created ones.

I tried this:

$.rawValue =  Sum(Row3[*].ColX[*].Cell4[*]...Row19[*].ColX[*].Cell4[*])

and

$.rawValue =  Sum(Row3.ColX[*].Cell4[*]...Row19.ColX[*].Cell4[*])

They don't work.

Avatar

Level 7

Hi,

Assuming you have a standard install, there is a sample in the Aodbe folder which might help. Bring it into Livecycle and look at the code.

Have a look here: (your acrobat version might be a different number

C:\Program Files (x86)\Adobe\Acrobat 10.0\Designer 9.0\EN\Samples\Forms\Purchase Order\Dynamic Interactive\Forms

Avatar

Level 2

Hi MinusZero,

Sadly, I didn't find anything that translates to the column instance creation. It does give me some solutions for future things I want to do with this form. Just doesn't cause the sum calculation work for created columns. Thanks though!