Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Referencing values of dynamic tables

Avatar

Level 1

Hi All of you!

I'm building a form for one of my clients. It is splitted into three languages depending who fills the form.

One can start from Polish then switch to English and watch everything filled. Another can do the same

but starts from English and follows to pages in Polish. There is also a German part in it.

Previously it was a static form so every value had been propagated between parts of a document

by binding it as Global.

Now I have a dynamic PDF with dynamic tables. I should generate rows of the same table

in each language part and a person who fills can start from any language (part of document).

I'm attaching a small example of two subforms. Each represents different language version. Buttons

of each one can add rows in both tables at the same moment.

I tried to write formulas for the cells to exchange data between. In this example it works. When I import these

subforms into my real document it stops working.

How can I bind values between cells of these tables to work both ways, starting from any of them?

Any part should copy a value from corresponding cells both ways.

http://strony.aster.pl/wystawa/WWW/tables_example.pdf

Regards,

Sylwester Zacheja

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

There is a sample here that might be some help to you: https://acrobat.com/#d=hkeDKn6SRo1FAvFUoY6Smw

If you look at the script in the second print button, you will see how it populates the values from the visible table to a hidden table.

Also this example may help: https://acrobat.com/#d=z9JRAb-7bKkdBwRHM4EHGw

Niall

View solution in original post

7 Replies

Avatar

Correct answer by
Level 10

Hi,

There is a sample here that might be some help to you: https://acrobat.com/#d=hkeDKn6SRo1FAvFUoY6Smw

If you look at the script in the second print button, you will see how it populates the values from the visible table to a hidden table.

Also this example may help: https://acrobat.com/#d=z9JRAb-7bKkdBwRHM4EHGw

Niall

Avatar

Level 1

Hi Niall,

thanks for you response.

I've found that example with duplicated tables before. This is similar to my case but it should work both ways: fill the first table with the value, it is being copied into the second table but next go to the second table, there generate another row and fill it thus it copies value into the first one. You should have bound cells each other to replicate values.

I tried using statement with this.rawValue.....["+this.parent.index"]..... but it hasn't solved my problem. Look inside my attached example for FormCalc rules in Calculate Event for cells. There are crosslinks between cells. This example works apart from my original PDF form. It doesn't work inside one.

Regards,

Sylwester Zacheja

Avatar

Level 10

Hi,

Instead of using the calculate event and looking back at the value of other objects, try the exit event of the object and push the value out.

Here is your form: https://acrobat.com/#d=1MJsnkbj82-FX40TjM3iiw

I have left the Document number/Numer dokumentu as a FormCalc script in the exit event. But with the Certificate of fiscal residence/Certyfikat rezydencji podatkowej I have used Javascript. Mainly because I want to track the index and resolve the node.

Hope that helps,

Niall

Avatar

Level 1

Hi Niall,

YOU ARE GREAT!!!

Thank you so much! You saved me a lot of time.

Regards,

Sylwester Zacheja

Avatar

Level 1

Hi Niall,

this time I have quite similar situation like in the previous case but now there are three copies of the table (in reality three different languages parts)

and you can start fill the tables from any of them. So every cell references to two other corresponding cells.

How can I write a script for exchanging data between three the same tables.

From your example:

this.rawValue = xfa.resolveNode("page1.Table1.Row1[" + this.parent.index + "]").quantity.rawValue;

but also:

this.rawValue = xfa.resolveNode("page2.Table1.Row1[" + this.parent.index + "]").quantity.rawValue;

and

this.rawValue = xfa.resolveNode("page3.Table1.Row1[" + this.parent.index + "]").quantity.rawValue;

Regards,

Sylwester Zacheja

Avatar

Level 10

Hi Sylwester,

The script you put in the post is from the first example, where the script was in the calculate event (looking back at the value in the other table).

The preferred solution is as per the previous post: https://acrobat.com/#d=pQcBT5qhgi8Ebx75H0r5yQ

In this example the script is in the exit event pushing the new value out to the other table. You should be able to push the new value out to many tables using the exit event:

...

xfa.resolveNode("page2.Table2.Row1[" + this.parent.index + "]").description.rawValue = this.rawValue;

xfa.resolveNode("page3.Table3.Row1[" + this.parent.index + "]").description.rawValue = this.rawValue;

...

//I am not sure about the translation part of the process.

Hope that helps,

Niall