OL Learn

Field with fixed value in more than one record


i have a little problem with the datamapper.
I need to save a value from previous record.

Or could we use a public value in the datamapper, and how?

In the example, in the second record, there are 14, 13, 10, 12 missing, which has to be remembered from the previous.

How can I achive this?

Here a little example about the problem:
90 000000J300222590829
40 Article Data
40 994246
20 00001 00000 000000000J005
14 Herr
13 E-Mail
12 AdressData
10 Personal Data
9 0012177000990422000000000000000000000 000067609990422420200716
2 0,00 0,00 175,80 0,00 0,00 0,00 0,00 175,80 0,00 0,00
1 003500000001003002225522312610000000000000000000
90 000000J599362890829
40 995832 Article 1
40 995672 Article 2
20 00001 00000
9 0010786000637819000000000000000000000 000067609637819720200626
2 0,00 4,95 94,90 0,00 0,00 0,00 0,00 94,90 0,00 0,00
1 003500000001003002225522312610000000000000000000

Thanks for your answers


you may store the value in a javascript variable.

The question for me is, where I can do this in the datamapper.

if it’s useful to use a variable to hold a value of a previous record depends on what you are trying to do.
What do you need to achieve at the end?
Maybe your data are transactional data, which would need loops to get all the detail fields imported?
So maybe you just would need to redefine your record structure?

Hi, the performance generating the Records is also an issue. Many Loops = low performance? @MartinS Greetz

Due tu multi-threading in the Datamapping process, storing values in global variables wouldn’t work. Let’s say you have 1000 records. Multi-threading kicks in and the record 1-100 is given to thread 1, 101-200 to thread 2, etc… So between record 100 and 101, no comparison is possible has they are handle by two separated thread.

What could work would be to achieve this in the metadata of Workflow using a script.
So in Workflow, after your Execute Datamapping step, which has its Output Type set to Metadata, you would have a script that go through all the metadata. It would look at the metadata’s fields holding the value from your data (14, 13, 12, 10). If they aren’t empty, it stores them into local variables in the script. If they are empty, it populates the metadata’s fields with it.

Then in your Content Creation step, you make sure you have check the Update Records from Metadata check box. That would fill-up the missing value just before the creation of the content (PDF).

Here’s a script that takes the first name from the first record and apply it to all other record. You can then modify it for your purpose:

// Load the Datamapper's resulting metadata file
var metadata = new ActiveXObject("MetadataLib.MetaFile");

var nbRecord = metadata.Job().Group(0).Count;
var firstName = metadata.Job().Group(0).Document(0).FieldByName('_vger_fld_FirstName');

//Loop through all document and set the first name to the one of the first record 
for(var index = 0; index < nbRecord ; index++)