Custom Calculation Script to Concatenate fields from separate page into 1 text box.
Hi there! I am trying to create a custom Calculation script for a text box that concatenates many text fields from a separate page that has space for the details of 20 users. I have been able to use the script below to pull the details of each user and display them with the "|" character in between the data and a line break at the end of each user, so that the following user begins on the following line. This method though is very cumbersome and will require so many lines of code to build in the potential for all 20 users detail fields to be filled in. Is there a way that I can have a looping getField?
var u1name = this.getField("Internal - xUsers - Requested User 1").value;
var u1id = this.getField("Internal - xUsers - ID Number 1").value;
var u1pc = this.getField("Internal - xUsers - PC Name 1").value;
var u1email = this.getField("Internal - xUsers - Email Address 1").value;
var u1sub = this.getField("Internal - xUsers - Embedded Sub Company 1").value;
var u1 = u1name + " | " + u1id + " | " + u1pc + " | " + u1email + " | " + u1sub
var u2name = this.getField("Internal - xUsers - Requested User 2").value;
var u2id = this.getField("Internal - xUsers - ID Number 2").value;
var u2pc = this.getField("Internal - xUsers - PC Name 2").value;
var u2email = this.getField("Internal - xUsers - Email Address 2").value;
var u2sub = this.getField("Internal - xUsers - Embedded Sub Company 2").value;
var u2 = u2name + " | " + u2id + " | " + u2pc + " | " + u2email + " | " + u2sub
event.value = u1 + "\n" + u2 + "\n";
Also, the "Embedded Sub Company" field will not always be filled in, is there a way that I can make that not show the "|" at the end of the email address, if the field is empty?
Thank you for any and all help with this!
