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

Concatenate new instances?

Natalieann75
Level 2
Level 2

Hello - I have been searching high and low for the answer to this, and I feel like I have come close, but I can't quite get there.  I am not skilled enough in JS or LiveCycle.

All I am wanting to do is stitch together the text from multiple new instances of one field.  I have a table that clients fill out their names, but the number of clients on the account can vary.  If there are three clients on the one account, I just need to combine those names into one field later on down the form (and use it as a floating field).

So I have:

  1. Client Name 1 - Fred Jones
  2. Client Name 2 - John Smith
  3. Client Name 3 - Jim Andrews

And the result needs to be something like:

Account Update for [ Fred Jones, John Smith, Jim Andrews]

I would collect that in an invisible field and show it in a floating field on the top of the form.

Would anyone be able to help me?  This feels like is should be  fairly straight forward but, like I said - I am not great at this.

Thankyou!

1 Accepted Solution
_Bruce_Robertson
Correct answer by
Level 10
Level 10

Here's another approach;

var aValues = "";

var list = this.resolveNodes("table.Row1.[hasValue(field)]")

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

aValues += list.item(i).field.rawValue + " ";

}

this.rawValue = aValues;

This uses the HasValue function to ignore any blank values and only calls the resolveNode(s) once, which will be quicker,

Regards

Bruce

View solution in original post

3 Replies
Natalieann75
Level 2
Level 2

I think I worked it out if anyone else is looking:

var nRows = table._Row1.count;

var aValues = " ";

for (I=0; I< nRows; i++)

{

aValues = aValues + xfa.resolveNode("table.Row[" +i+"].field").rawValue + " ";

}

this.rawValue = aValues;

Now I just have to stop it showing "null" when its blank  and I am away

_Bruce_Robertson
Correct answer by
Level 10
Level 10

Here's another approach;

var aValues = "";

var list = this.resolveNodes("table.Row1.[hasValue(field)]")

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

aValues += list.item(i).field.rawValue + " ";

}

this.rawValue = aValues;

This uses the HasValue function to ignore any blank values and only calls the resolveNode(s) once, which will be quicker,

Regards

Bruce

View solution in original post

Natalieann75
Level 2
Level 2

Bruce, thank to you so much! That's brilliant...

Nat