String in Designer

Hello, I’m completely new to planet press.

I have a question, Using a CSV, I have a Column that I want split into 2 columns. Based on a Character. “The Value Comes in as First Name Last Name X411” I want to take the “X411” and place it in a column next to it.

I tried using Add Extraction, but could only get it to copy the column.

I’m sure this is a very noob question. Just trying to get that ah ha moment with PPConnect. Any help would be greatly appreciated.

Thank You in advance.

Set your two fields’ Mode to JavaScript. For the first one (the name), use the following code:

let entireField = data.extract('MyField',0);
entireField.substr(0, entireField.lastIndexOf(" ")).trim(); 

For the second one (the X411 code), use this:

let entireField = data.extract('MyField',0);
entireField.substr(entireField.lastIndexOf(" ")).trim();

In both cases, the code is searching for the last instance of a “space” character in the original data, using JavaScrpt’s lastIndexOf() method. It uses that location to extract characters up to that location for the first field, and from that location for the second one.