Lifecycle Designer, add instanses to table

Avatar

Avatar
Affirm 1
Level 1
pawel
Level 1

Likes

2 likes

Total Posts

3 posts

Correct reply

1 solution
Top badges earned
Affirm 1
Boost 1
View profile

Avatar
Affirm 1
Level 1
pawel
Level 1

Likes

2 likes

Total Posts

3 posts

Correct reply

1 solution
Top badges earned
Affirm 1
Boost 1
View profile
pawel
Level 1

14-04-2021

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Affirm 1
Level 1
pawel
Level 1

Likes

2 likes

Total Posts

3 posts

Correct reply

1 solution
Top badges earned
Affirm 1
Boost 1
View profile

Avatar
Affirm 1
Level 1
pawel
Level 1

Likes

2 likes

Total Posts

3 posts

Correct reply

1 solution
Top badges earned
Affirm 1
Boost 1
View profile
pawel
Level 1

28-04-2021

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

 

Answers (0)