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

How to copy values from multiple table rows into text field?

aka44356106
Level 4
Level 4

Sir i have a new query

in a dynamic form add instance create multiple row by click a button

Table4._Row1.addInstance(0);

value of Table4.Row1(0).cell1.rawvalue, Table4.Row1(1).cell1.rawvalue, ............

can be copy in a textfield?

1 Accepted Solution
radzmar
Correct answer by
Level 10
Level 10

Well, the accessor names are all case-sensitive, so you may have to correct them.

Try:

  1. var oCells = Table4.resolveNodes("Row1.[Cell1 ne null]"), // Reference all instances of Row1, where Cell1 is not null 
  2.     cResult = "", // the output string 
  3.     i; // a count variable 
  4.  
  5. for (i = 0; i < oCells.length; i += 1) { 
  6.     cResult += oCells.item(i).Cell1.rawValue + " "; // Add rawValue of each filled cell to the output string. 
  7. this.rawValue = cResult;

View solution in original post

5 Replies
radzmar
Level 10
Level 10

To collect the text values of multiple rows, use a for loop.

var oCells = Table4.resolveNodes("Row1.[cell1 ne null]"), // Reference all instances of Row1, where cell1 is not null

    cResult = "", // the output string

    i; // a count variable

for (i = 0; i < oCells.length; i += 1) {

    cResult += oCells.item(i).cell1.rawValue + " "; // Add rawValue of each filled cell to the output string.

}

this.rawValue = cResult;

radzmar
Correct answer by
Level 10
Level 10

Well, the accessor names are all case-sensitive, so you may have to correct them.

Try:

  1. var oCells = Table4.resolveNodes("Row1.[Cell1 ne null]"), // Reference all instances of Row1, where Cell1 is not null 
  2.     cResult = "", // the output string 
  3.     i; // a count variable 
  4.  
  5. for (i = 0; i < oCells.length; i += 1) { 
  6.     cResult += oCells.item(i).Cell1.rawValue + " "; // Add rawValue of each filled cell to the output string. 
  7. this.rawValue = cResult;

View solution in original post

aka44356106
Level 4
Level 4

sir i want cResult in these formats

1. when instant manager count is 1

cResult outout is    Table4.Row1.cell1.rawvalue

2. when instant manager count is 2

cResult outout is    Table4.Row1[0].cell1.rawvalue + "and" +  Table4.Row1[1].cell1.rawvalue

3. when instant manager count is more than 2

cResult outout is    Table4.Row1[0].cell1.rawvalue + "," +  Table4.Row1[1].cell1.rawvalue + "and" + Table4.Row1[2].cell1.rawvalue

simply output will be  

instant manager count    = 1                             A

instant manager count    = 2                             A and B

instant manager count    = 3                            A, B, and C

instant manager count    = 4                            A, B, C and D

...........................