Expand my Community achievements bar.

SOLVED

Copy computed value in a dynamic table to another subform

Avatar

Level 4

I have a lengthy form. In some cases, users fill a some cells in a dynamic table, Each row in the dynamic table has a cell where the row is summed.

I need to copy some of the values from each row in the expandable table to a comparable table located elsewhere (different page) in the form. Thanks to help received on this forum, I successfully perform this task with the following bit of java script in the exit event of the first dynamic table.

xfa.resolveNode("targetcelldifferentpage.Table1.Row1(" + this.parent.index + "]").CellName.rawValue = this.rawValue;

The table receiving the copied value is set to expand with the first table (through the click event in the add button, rows are added to each table).

However, when I try to copy the row sum cell (where there is a formcalc calculation in the calculate event, the exit event action does not work. I have tried using the change event function but nothing seems to work.

Is there a different formula to use since  I am using a computed value rather than a user input? Is it the use of both java script and formcalc in the same cell?

Graphic of the two pages; I have copied some values in the first table to show success in copying user input in the dynamic row values to the second table (but the not computed value found in YTD.

1562725_pastedImage_3.png

Thank you in advance for help.

1 Accepted Solution

Avatar

Correct answer by
Level 10

If I understand what you are saying you have code in the exit event of the YTD field to push the value to the second table, but if this is a calculated field then the exit event wont fire unless you click in and out of the YTD field ... you should be able to try that and see if the exit event code fires.

I think you will want some code in the calculate event of the field in the second table to pull the value in.  This code will be similar but the this.rawValue will be on the right of the equal sign.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

If I understand what you are saying you have code in the exit event of the YTD field to push the value to the second table, but if this is a calculated field then the exit event wont fire unless you click in and out of the YTD field ... you should be able to try that and see if the exit event code fires.

I think you will want some code in the calculate event of the field in the second table to pull the value in.  This code will be similar but the this.rawValue will be on the right of the equal sign.

Avatar

Level 4

Bruce:

Flipping the code and placing it in the calculate event in the second table works. I would have never thought of that solution but now sounds most logical once you explain it.

Thank you for solving this problem.