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
SOLVED

Lifecycle Designer, add instanses to table

Avatar

Level 2

Hi, we have a problem with adding rows to a table in script.

 

We need to add couple of rows via the script.

We use init event of the table

This code is not working

for (var i = 1; i < aantalDossiers.length ; i++) {
mod_gegevens.main.subform_vaststellingen.subform_gecontroleerdeDossiers.Table2._Row1.addInstance(true);
}

The problem is the loop because if i do this:

mod_gegevens.main.subform_vaststellingen.subform_gecontroleerdeDossiers.Table2._Row1.addInstance(true);
mod_gegevens.main.subform_vaststellingen.subform_gecontroleerdeDossiers.Table2._Row1.addInstance(true);
mod_gegevens.main.subform_vaststellingen.subform_gecontroleerdeDossiers.Table2._Row1.addInstance(true);
mod_gegevens.main.subform_vaststellingen.subform_gecontroleerdeDossiers.Table2._Row1.addInstance(true);

 

it works.

 

By the way, i'm getting this error:

Unable to add instance of 'Row1': recursive or cyclic situation detected.

 

Any idee how can we do this in een loop ?

regards

1 Accepted Solution

Avatar

Correct answer by
Level 2

so my solution was to put the script into Table2.Row1 init event

and to use ResolveNodes function

 

var aantalDossiers = mod_vbm_gegevens.main.subform_vaststellingen.subform_dossiers.all;
var rows = mod_vbm_gegevens.main.subform_vaststellingen.subform_gecontroleerdeDossiers.Table2.resolveNodes("Row1[*]");

 

in the loop i could then put in each new row the data.

var row = rows.item(i);

row.Cell2.rawValue = "some text";

 

View solution in original post

3 Replies

Avatar

Employee
would you mind explaining your solution to the community in case someone else has a similar problem?

Avatar

Correct answer by
Level 2

so my solution was to put the script into Table2.Row1 init event

and to use ResolveNodes function

 

var aantalDossiers = mod_vbm_gegevens.main.subform_vaststellingen.subform_dossiers.all;
var rows = mod_vbm_gegevens.main.subform_vaststellingen.subform_gecontroleerdeDossiers.Table2.resolveNodes("Row1[*]");

 

in the loop i could then put in each new row the data.

var row = rows.item(i);

row.Cell2.rawValue = "some text";

 

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now