Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
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

Level 2
i found the solution. thx anyways

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";