Skip to main content
Participant
December 1, 2023
Question

How to Separate Characters from Imported CSV Fields

  • December 1, 2023
  • 1 reply
  • 294 views

Hi All -

I am using an online form for contractors to fill out when they join my company and/or become affiliated vendors. The form is then exported to a csv file, which is in turn imported into a bespoke pdf contract we have created.

 

When exporting into our pdf, I need to take their tax id / SSN one character at a time.

eg. SSN = 123 - 45 - 6789 needs to become nine separate fields of 1,2,3,4,5,6,7,8, and 9.

(We use the tax numbers in a few different places in the contracts and they have to be formated a little differently each time, so the individual character export works perfectly for that, if I can pull it off.)

 

I'm thinking there may be a script I can use in the pdf form to accomplish this, but I can't find one anywhere. Any help and/or advice on how to get this done would be really appreciated. Thanks!

This topic has been closed for replies.

1 reply

JR Boulay
Community Expert
Community Expert
December 1, 2023

Yes, you can use something like this:

var str = this.getField("SSN").valueAsString;
// var str = "123 - 45 - 6789";
str = str.replace(/\s|-/g, ""); // remove dashes and blank spaces
myArray = str.split("");
// console.println(myArray);
Acrobate du PDF, InDesigner et Photoshopographe