Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

an easy syntax question I hope!

Avatar

Level 3

Some months ago I got some assistance by Jono (thank you) where data from one cell in one table could be repeated in another table on my form - ie. all other cells were indepedant apart from a single cell.

The caveat was that the first table could grow by clicking an add button - ie. it started with only one row but could have more and the table cell that was being repeated needed to retain it's individual content.

So, here was the code I used:

form1.Review.reviewsub.reviewtable._planrow.count = form1.plan.plansub.plantable._planrow.count;

var vCol1 = this.resolveNodes("form1.plan.plansub.plantable.planrow[*].wb");

var vCol2 = this.resolveNodes("form1.Review.reviewsub.reviewtable.planrow[*].wb");

for (var i = 0; i < vCol1.length; i ++) {

             vCol2.item(i).rawValue = vCol1.item(i).rawValue;

}

this is placed in the onsave event of the table where the data is being pulled to and the cell that it brings data into is called wb

it works a treat.

However, and I'm being really dumb here, I have now been asked to pull in data from another table cell within the same originating table called 'better'. Problem is that if I simply repeat lines 2 and 3 of the above code it only pulls in data from the 'better' cell and not the 'wb' cell anymore.

So it's a syntax question - how do I get lines 2 and 3 of the code to work for BOTH 'wb' and 'better' - I've tried

var vCol1 = this.resolveNodes("form1.plan.plansub.plantable.planrow[*].wb","form1.plan.plansub.plantable.planrow[*].better");

i've tried

var vCol1 = this.resolveNodes("form1.plan.plansub.plantable.planrow[*].wb"),("form1.plan.plansub.plantable.planrow[*].better");

and a few others - as you can tell, my javascripting is a bit shaky.

Anyone help?



1 Accepted Solution

Avatar

Correct answer by
Level 3

sorted it - thought I would post it here so someone else can use if they need to.

The correct code is:

form1.Review.reviewsub.reviewtable._planrow.count = form1.plan.plansub.plantable._planrow.count;

var vCol1 = this.resolveNodes("form1.plan.plansub.plantable.planrow[*].better");

var vCol2 = this.resolveNodes("form1.Review.reviewsub.reviewtable.planrow[*].better");

var vCol3 = this.resolveNodes("form1.plan.plansub.plantable.planrow[*].wb");

var vCol4 = this.resolveNodes("form1.Review.reviewsub.reviewtable.planrow[*].wb");

for (var i = 0; i < vCol1.length; i ++) {

             vCol2.item(i).rawValue = vCol1.item(i).rawValue;

             vCol4.item(i).rawValue = vCol3.item(i).rawValue;

}

I was getting confused as to the names of the variables - thinking vCol related to the columns directly (they can be called anything) - so effectively I had to simply double up on the variables to ensure that both cells in the origin table cells (vCol1 and vCol3) were mapped to the subsequent table cells(vCol2 and vCol4 respectively)

View solution in original post

1 Reply

Avatar

Correct answer by
Level 3

sorted it - thought I would post it here so someone else can use if they need to.

The correct code is:

form1.Review.reviewsub.reviewtable._planrow.count = form1.plan.plansub.plantable._planrow.count;

var vCol1 = this.resolveNodes("form1.plan.plansub.plantable.planrow[*].better");

var vCol2 = this.resolveNodes("form1.Review.reviewsub.reviewtable.planrow[*].better");

var vCol3 = this.resolveNodes("form1.plan.plansub.plantable.planrow[*].wb");

var vCol4 = this.resolveNodes("form1.Review.reviewsub.reviewtable.planrow[*].wb");

for (var i = 0; i < vCol1.length; i ++) {

             vCol2.item(i).rawValue = vCol1.item(i).rawValue;

             vCol4.item(i).rawValue = vCol3.item(i).rawValue;

}

I was getting confused as to the names of the variables - thinking vCol related to the columns directly (they can be called anything) - so effectively I had to simply double up on the variables to ensure that both cells in the origin table cells (vCol1 and vCol3) were mapped to the subsequent table cells(vCol2 and vCol4 respectively)