Split the variable and paste in in multiple fields on the form

Kachu
Kilo Sage

HI All we have a form where we are generating the PDF out of the it. But in the PDF template we have 2 fields for State and 5 fields for Zip code find_real_file.png AS shown in the image. Now we have string fields for both

 one the data is entered in the fields i would like to separate & split the State  like NY to N & Y and paste it on the  table side variables that we created for PDF one of the example where i spilt the Name in FIrts , middle and last is below can any one  send me sample code for the splittimg the variable  into single digit and past it accordingly ?

find_real_file.png

The above script was written in transform map not i need that on the client script  or record producer script

 

Thank You community

1 ACCEPTED SOLUTION

var data = "57898";
data.split('');

//I am not sure how you would reference the pdf document field, but the individual fields can be filled in from the array.
A = data[0];
B = data[1];
C = data[2];
D = data[3];
E = data[4];

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

View solution in original post

3 REPLIES 3

vkachineni
Kilo Sage
Kilo Sage

To split a string

var data = "NY city";

data.split('');

//output is an array of characters: ["N", "Y", " ", "c", "i", "t", "y"]
Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

I am getting Data from Record producer to Case and from case to  the Document 

So  City Zipcode is 57898

  there are 5 fields on the document  named  A,B,C,D,E

So data should be stored  as 5-> A,7->b,8->C  so on..

//Varibale name is "A"
var data = getDisplayValue('u_zipcode')
for(var i =0; i<data.length; i++){
 data.split('');
return  data[i];  //how can i return the first,second... values ? is this correct ?
 

var data = "57898";
data.split('');

//I am not sure how you would reference the pdf document field, but the individual fields can be filled in from the array.
A = data[0];
B = data[1];
C = data[2];
D = data[3];
E = data[4];

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022