Looping through cell in table | Community
Skip to main content
New Participant
November 19, 2015
Solved

Looping through cell in table

  • November 19, 2015
  • 12 replies
  • 9117 views

Hi all!

I have been digging but can't find my answer.  I have a table that you can add rows to.  In the same cell in each row I have to validate if the number in the field starts with a 4 or 5 ( the number is a total of 6 digits long).  I have java script that validates the 4 or 5.  but I need to loop through all the rows for that cell. Right now just validates on the first row.

Help!

Thank you!

Jodi

var Grant = Main.PreApproved.Table1.Row1.Fund.rawValue

var GrantFund = Grant.charAt(0)


if  (GrantFund == 4 || GrantFund == 5).......

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by _Bruce_Robertson

Hi,

If you table has only one Row object that repeats (as opposed to a Row1, Row2, ...) you should be able to use;

 

var rows = Main.PreApproved.Table1.resolveNodes("Row1[*]");

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

    var row = rows.item(i);

    var GrantFund = row.Fund.isNull ? 0 : row.Fund.rawValue.charAt(0);

    if  (GrantFund == 4 || GrantFund == 5) {

        //...

    }

}

 

Regards

Bruce

12 replies

Jodi1725Author
New Participant
November 23, 2015

Awesome!  Thank you Bruce!  I will try it tomorrow (too many meetings today )

When I was lookoing at the Javascript I would get confused byt the (var i = 1; i< rows.lenght; i++) part. 
I never understood how to to it or what it meant.  Thank you again!

I will let you know how it goes!

Jodi

_Bruce_Robertson
_Bruce_RobertsonAccepted solution
New Participant
November 22, 2015

Hi,

If you table has only one Row object that repeats (as opposed to a Row1, Row2, ...) you should be able to use;

 

var rows = Main.PreApproved.Table1.resolveNodes("Row1[*]");

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

    var row = rows.item(i);

    var GrantFund = row.Fund.isNull ? 0 : row.Fund.rawValue.charAt(0);

    if  (GrantFund == 4 || GrantFund == 5) {

        //...

    }

}

 

Regards

Bruce