Concatenate new instances?

Avatar

Avatar

Natalieann75

Avatar

Natalieann75

Natalieann75

29-05-2019

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!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

_Bruce_Robertson

MVP

Avatar

_Bruce_Robertson

MVP

_Bruce_Robertson
MVP

31-05-2019

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

Answers (2)

Answers (2)

Avatar

Avatar

Natalieann75

Avatar

Natalieann75

Natalieann75

29-05-2019

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

Avatar

Natalieann75

Avatar

Natalieann75

Natalieann75

02-06-2019

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

Nat