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

Loop Through Subform Instances

Avatar

Avatar
Level 1
BassPlayer19
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile

Avatar
Level 1
BassPlayer19
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile
BassPlayer19
Level 1

20-06-2016

I'm very new to Javascripts and Livecycle,

I have 4 fields (field1.rawValue, field2.rawValue, field3.rawValue & field4.rawValue wrapped in Subform1.  I'm attempting to sum values entered in fields 1, 2, & 3 into field 4 with the following script.

var myFields = field1.field2.field3.resolveNodes("Subform1[*]");

var sum = 0.0

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

sum += myFields.item(i).field4.rawValue;

}

this.rawValue = sum;

When a new instance is added field4(1) should be the sum of field4(0) + field(1) + field2(1) + field3(1).

Thanks,

Accepted Solutions (0)

Answers (2)

Answers (2)

Avatar

Avatar
Validate 10
Level 2
Jodi1725
Level 2

Likes

6 likes

Total Posts

113 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
Jodi1725
Level 2

Likes

6 likes

Total Posts

113 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
Jodi1725
Level 2

29-01-2018

Hey all!

The blog was extremely helpful!  Does anyone know how to loop through more than one field in a subform?

I am trying to create code where we check for multiple empty fields, looping through the subforms.

Any ideas?

Thanks!

Jodi

Avatar

Avatar
Level 1
deer_reema
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
deer_reema
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
deer_reema
Level 1

21-12-2016