Merge repeat into single record


Have a tricky datamapper.
The datamapper read’s out lines from a pdf.
Each line have several fields and one field (desription) can be on multiple lines
The extraction can be done with a normal extract and a repeat then i loks like this:
This gives me a challenge when I have to redesign the page i a detailed table.
As far as i know I can’t have a table with a row where i have multiple field’s and the on the same line a field from a detailed table in the same record.

Is there a way to combine all the (Description record lines) in the detalied table to a single field within the datamapper or is it posible to do that in the templage?

Start by creating a property named Description in the preprocessor step. Make sure its scope is set to Each record.

The process has two loops: one that reads all line items, and a nested one that reads multi-line descriptions. They will look something like this:

In the main loop, don’t extract the first line of the description. Instead, use an Action task to store its value in your Description property. Then, in the nested loop that reads the following description lines, replace your current Extract step with an Action step that appends each additional line to your Description property. The code would look something like this: += "<br />"+data.extract(12,37,0,1,"");

Notice how the code prepends a <br> element before each additional line in the description so that you get proper formatting in your template later on.

Finally, immediately after the nested loop has completed, add an Extract step that extracts the value stored in the Description property to a detail table field named Description. Make sure the Append values to current record option is ticked so that the process doesn’t create a brand new new detail record containing only the description:

I am attaching a sample DataMapping config that you can examine for more information.MultiLine-Description.OL-datamapper (6.8 KB)

1 Like

Thanks Phil

Can see that your datamapper is working on the text file.
What am i doing wrong

The inner loop extraction the lines are set as this: += data.extract(37.4,54.69,0,3.5,"");

In Extract Full dexcription after the inner loop, I Can’t select the sourceRecord property - it is not on the list.

And in the first Action Property before the inner look - I can’t select anything in Property

Also tried to change you Datamapper in the inner loop to
Then the Extract full description does not change to .Description2 in the Property list…
Is there a secret trick to this…

There’s no secret. you just have to create/change the Description property in the preprocessor step (which is the very first thing I mentioned in my previous reply):

Sorry did not see that the Description fileld was created in the Preprocessor step, was so focused on the Action step.
Thanks it is working.

1 Like