Upland OL User community

Datamapping Question

I have a sample data below where I find it difficult to map. It is Pipe delimited and also have

separate lines for Promotional and Transactional data. Searched all over the knowledge base source

but didn’t find any luck on how to map this.












Hi ianvela35,

That data requires JavaScript arrays to map. I added a Repeat Step set to Until No More Elements. Selected the H and added a Multiple Conditions Step. Select the entire H line and dragged the extraction into the first Case of the Multiple Conditions step which I named H. Changed the extractions mode to JavaScript. In the Expression section I added the following code.

var hArray = data.extract(1,4000,0,1,"<br />").split("|");

The first line splits the entire row using the | (pipe) as its delimiter. The second line extracts the first index of the array and that becomes your first field. Then simply add another record by clicking Add JavaScript Field next to the field list drop down menu and extract the next index of the array.


Now index 1 becomes your second field. Note that you don’t need to declare the array each time but only when you extract the next line. Example for the P line.

var pArray = data.extract(1,4000,0,1,"<br />").split("|");

Also note that for the data.extract above I usually set its length to 4000. This ensures that the entire line is extracted and avoids the data mapping to fail should a line in your master database be longer than when you originally extracted it. You need be be sure that other H, P or T lines in other records that are longer than the record you are mapping is catered for otherwise they wont be mapped of course.

Another note is that any lines that are single lines I have added to the Record data table and not a detail table. However for the T lines I have added to detailT which will be used in a detail table when you get to the design phase.

Hope this helps. (Thanks to Rod for the tip)

Data Mapper Sample



Hi Sharne,

Thanks for the Javascript for extraction, it did a great help, however I checked the example you sent me yesterday and the mapping only contains the first 4 lines,You didn’t include the rest of the data including the last line marked as “F”. Each record starts with the indicator “P”, I knew it could be fixed by setting up the boundaries, however In this kind of data, we don’t have a specific indicator which would tell us how each record marked as “P” would end.


I did not bother setting boundaries because your question was more focused on mapping the data into fields. The way the record ends is irrelevant in my opinion. Just set the delimiter to On Text (Word To Find P) and the boundaries to On Delimiter. The footer line on the last record can just be ignored since it most likely wont be relevant. I also ignored the header line in the below updated example (Add/Remove Line set to -1) and removed the H case and extraction since I assume the header too is irrelevant.

Workflow Sample Updated

If you need anything else let me know.



Hi Sharne,
I was able to solve the problem regarding boundaries when I played around the
datamapper settings for around an hour after my follow up question.
I really appreciate your help, thank you very much.