Skip to main content
Known Participant
October 2, 2024
Answered

Concatenate two text fields

  • October 2, 2024
  • 1 reply
  • 808 views

I have two text fields - Field1 and Field2.  The operator will enter either 1) a name into just Field1 or 2) names into both Field1 and Field2.  The result will be entered into Field3.  If a name is entered only into Field1, then the contents of Field1 should poplulate in Field3.  If names are entered into both Field1 and Field2, then both names should concatenate and populate in Field3 with the word "and" in between the two names.  Any help with script is appreciated.  Thanks.

This topic has been closed for replies.
Correct answer PDF Automation Station

Enter the following custom calculation script in Field3:

if(!this.getField("Field2").value)
{
event.value=this.getField("Field1").value;
}
else
{
event.value=this.getField("Field1").value + " and " +this.getField("Field2").value;
}

1 reply

PDF Automation Station
Community Expert
Community Expert
October 2, 2024

Enter the following custom calculation script in Field3:

if(!this.getField("Field2").value)
{
event.value=this.getField("Field1").value;
}
else
{
event.value=this.getField("Field1").value + " and " +this.getField("Field2").value;
}

Known Participant
October 2, 2024

Perfect.  Thank you.