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

Count dropdown objects in repeating subform if user selects "N/A".

Avatar

Avatar
Validate 100
Level 3
DKinsley
Level 3

Likes

9 likes

Total Posts

545 posts

Correct Reply

5 solutions
Top badges earned
Validate 100
Validate 50
Validate 25
Validate 10
Validate 1
View profile

Avatar
Validate 100
Level 3
DKinsley
Level 3

Likes

9 likes

Total Posts

545 posts

Correct Reply

5 solutions
Top badges earned
Validate 100
Validate 50
Validate 25
Validate 10
Validate 1
View profile
DKinsley
Level 3

08-12-2015

I am trying to count the number of dropdowns the user selected "N/A" in a repeating subform. I want the total to appear in a numericfield or textfield. Here's my form layout and my script that unfortunitly does not work. I placed it in the ready:layout event so the total updates as the number of N/A's changes.

Hierarchy.GIFScript.GIF

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile
_Bruce_Robertson
MVP

08-12-2015

Hi,

I would put the code in the calculate event of the text field, something like;

var result = 0;

var instanceCount = _Subform2.count;

var instances = Form1.resolveNodes("Subform2[*]");

for (var i = 0; i < instanceCount; i++)

{

  if (instances.item(i).Table1.Row2.Score.rawValue == "N/A") {

  result++;

  }

}

this.rawValue = result;

The reference to "_Subform2.count" will ensure the code is executed every time an instance is added or removed.

Regards

Bruce

Answers (1)

Answers (1)

Avatar

Avatar
Validate 100
Level 3
DKinsley
Level 3

Likes

9 likes

Total Posts

545 posts

Correct Reply

5 solutions
Top badges earned
Validate 100
Validate 50
Validate 25
Validate 10
Validate 1
View profile

Avatar
Validate 100
Level 3
DKinsley
Level 3

Likes

9 likes

Total Posts

545 posts

Correct Reply

5 solutions
Top badges earned
Validate 100
Validate 50
Validate 25
Validate 10
Validate 1
View profile
DKinsley
Level 3

09-12-2015

Thank you so very much!

Works great!