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

For Loop Break

TehnologiaInformatiei
Level 2
Level 2

Hello,

How can I break the for loop if all the checkboxes (A,B,C) from all the rows (Row1[*]) are unchecked?

The below code is in the click event of a button and it shows the message box for all the number of rows and is not working the way I want.

Thanks.

var nods = xfa.resolveNodes("pctA.A.Row1[*].Q");

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

if (nods.item(i).A.rawValue == "0" && nods.item(i).B.rawValue == "0" && nods.item(i).C.rawValue == "0")

{

     xfa.host.messageBox("Warning1!\n\nWarning2", "WTitle", 0, 0);

}

else

{//continue with code}

1 Accepted Solution
_Bruce_Robertson
Correct answer by
Level 10
Level 10

Hi,

I think you need to use the break keyword after the messageBox, so;

var nods = xfa.resolveNodes("pctA.A.Row1[*].Q"); 

for (var i = 0; i < nods.length; i++)  if (nods.item(i).A.rawValue == "0" && nods.item(i).B.rawValue == "0" && nods.item(i).C.rawValue == "0"

     xfa.host.messageBox("Warning1!\n\nWarning2", "WTitle", 0, 0); 

    break;

else 

{//continue with code} 

Regards

Bruce

View solution in original post

1 Reply
_Bruce_Robertson
Correct answer by
Level 10
Level 10

Hi,

I think you need to use the break keyword after the messageBox, so;

var nods = xfa.resolveNodes("pctA.A.Row1[*].Q"); 

for (var i = 0; i < nods.length; i++)  if (nods.item(i).A.rawValue == "0" && nods.item(i).B.rawValue == "0" && nods.item(i).C.rawValue == "0"

     xfa.host.messageBox("Warning1!\n\nWarning2", "WTitle", 0, 0); 

    break;

else 

{//continue with code} 

Regards

Bruce

View solution in original post