Expand my Community achievements bar.

SOLVED

Concatenate new instances?

Avatar

Level 3

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

Avatar

Correct answer by
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

Avatar

Level 3

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

Avatar

Correct answer by
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

Avatar

Level 3

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

Nat