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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Lifecycle Designer, add instanses to table

pawel
Level 2
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
pawel
Correct answer by
Level 2
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
pawel
Level 2
Level 2
i found the solution. thx anyways
Kosta_Prokopiu1
Employee
Employee
would you mind explaining your solution to the community in case someone else has a similar problem?
pawel
Correct answer by
Level 2
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