Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Help with Table cell data being passed via action script

Avatar

Level 3

I am trying to pass some data to a table cell that is set-up to grow dynamically. Each time a check box is selected, a new Instance of the table row is created, and the first cell is being populated via an action script.

The issue is that the first cell populates fine, but each successive row, the first cell is being overritten and the new cells are not being populated.

I have attached the script, but looking at it, the error seems obvious, but the solution escapes me.

The error seems to be that both instances of adding text to a cell is pointing to the same cell, regardless of the new instance of a row being created. Hence I think the solution would lie in the fact that there must be some other statement, checking if a new cell (row) is created and there is content in original cell, then don't override cell but go to cell 2.... or something like that.

Any advice and help is greatly appreciated.

Code:

When first check box is clicked, the action script is as follows

if (this.rawValue == "1") {

  this.resolveNode('Table1.Log_subsections._Row1').addInstance(1);

  if (xfa.host.version < 8) {

      xfa.form.recalculate(1);

  }

  this.resolveNode("Table1.Log_subsections.Row1.loc").rawValue = "FR 1";

  xfa.host.setFocus("Table1.Log_subsections.Row1.amt");

}

When second check box is clicked, the action script is as follows

if (this.rawValue == "1") {

  this.resolveNode('Table1.Log_subsections._Row1').addInstance(1);

  if (xfa.host.version < 8) {

      xfa.form.recalculate(1);

  }

  this.resolveNode("Table1.Log_subsections.Row1.loc").rawValue = "FR 2";

  xfa.host.setFocus("Table1.Log_subsections.Row1.amt");

}

NOTE: The hierachy of the table was tested in 2 different formats.

  1. With and without the row wrapped in a Group Choice Subsection, whereby either the Subsection or the Row where made active as to Repeat Section for Each Data Item.
  2. With multiple combination of the above set-up.

Img1.PNGImg2.PNGImg3.PNGImg4.PNG

Message was edited by: Shailevit

Please note the attached images for clarification:

0 Replies