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

Display all instances of dynamic field, separated by semicolon

Avatar

Avatar
Validate 1
Level 1
SafetyMan1989
Level 1

Likes

4 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 1
SafetyMan1989
Level 1

Likes

4 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
SafetyMan1989
Level 1

06-11-2018

I currently have a form where I dynamically populate the To and CC fields of an automated email. First, I grab the value of the 'email' text fields in a table, and I populate another text field with it's value, then the 'submit email' button references each of the separate text fields to populate To and CC. This part works fine.

However the last row in the table is dynamic, and therefore may have multiple instances.

I don't know how to loop through the instances and grab each email separately, right now it only returns the last instance of the dynamic row's email field. This is what I have:

var countRows = Table5.RepeatingRow.instanceManager.count;

for(i=0; i<countRows; i++){

this.resolveNode("TextFieldA").rawValue = xfa.resolveNode("RepeatingRow["+ i +"].Email").rawValue + "; "

next;

}

If there are 3 instances of RepeatingRow.Email, I would like the rawValue of TextFieldA to be "email1; email2; email3" etc

any help is greatly appreciated!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

395 likes

Total Posts

2,686 posts

Correct Reply

491 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

395 likes

Total Posts

2,686 posts

Correct Reply

491 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

06-11-2018

This should to the trick:

var oRows = Table5.resolveNodes("RepeatingRow[*]"),

cResult = "";

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

    cResult += oRows.item(i).Email.rawValue;

    if (i > 0) {

        cResult += "; ";

    }

}

// add your script to use cResult

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 1
SafetyMan1989
Level 1

Likes

4 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 1
SafetyMan1989
Level 1

Likes

4 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
SafetyMan1989
Level 1

06-11-2018

That worked like a charm radzmar!! Thank you very much for the quick reply.

For anyone else that may need to use this code, the only edit I made was in this line:

(i > 0)

changed to

(i >= 0)

I failed to mention in my first post that I start with one instance -- so when I first tried the code it would combine the initial and first instance, then separate the others -- eg "email1email2; email 3; email 4"

This is a much more efficient way of doing it too