cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

pushing values to child infotable using for loop dynamically

SM_10230689
11-Garnet

pushing values to child infotable using for loop dynamically

SM_10230689_0-1661498511027.png

 

 

I want to push values to child infotables dynamically using nested for loop, in the above code the "infoname" parameter is the child infotable names which are dynamic. 

 

While executing the code i am not getting any issue, but the infotables are showing blank.

if i am passing the actual name instead of "infoname parameter" the values are showing in that particular infotable.

 

Is there any way to pass values to child infotables dynamically?

ACCEPTED SOLUTION

Accepted Solutions

What @Sathishkumar_C  meant was:

 

for...{

   infoname = "Infotable"+k;

   for..

      ....

   }

   let newRow = {};

   newRow[infoname] = infotableTemp;

   parentinfotable.AddRow(newRow);

}

 

This may work but some points on this:

- dont forget to recreate the "infotableTemp" on each run (or it will just keep adding rows and rows)

- having a different name for each nested infotable does not make much sense

View solution in original post

6 REPLIES 6

Try to add blank row first... than you can update dynamically.. 

 

parentinfotable.AddRow({});
parentinfotable.rows[parentinfotable.length - 1][infoname] = infotableTemp;

 

 

Hi Sathish,

 

Have added blank first row as mentioned, but still the child infotables as coming null.

 

Thanks.

try to share the code and sample data here..

Hi Sathish,

 

Have shared the code in the first post where "propertyList" is a infotable, i am looping through the "Name" column and getting value from "results" which is json output. 

so for each name in propertyList it needs to push data to different infotables.

and infoname is the nested info table names. it will dynamically change based on value of k.

 

SM_10230689_0-1661524982898.png

 

 

Thanks.

 

Please share your datashape and code as editable (not image). Let me recreate in my instance.

What @Sathishkumar_C  meant was:

 

for...{

   infoname = "Infotable"+k;

   for..

      ....

   }

   let newRow = {};

   newRow[infoname] = infotableTemp;

   parentinfotable.AddRow(newRow);

}

 

This may work but some points on this:

- dont forget to recreate the "infotableTemp" on each run (or it will just keep adding rows and rows)

- having a different name for each nested infotable does not make much sense

Announcements


Top Tags