Hello,
I am having trouble solving what appears to be a straightforward issue, and I was wondering if anyone might assist me.
I am trying to update the metadata of datamapper with updated fields from CSV file. CSV field names are similar to datamapper fields. and there have been corrections made to the CSV data. check the script below
sample.txt (1.4 KB)
Here, I want to update the datamapper values by running the js script. For that, I used the Run Script plugin, and after the plugin, I used the Update Data Record task to update all database records with the values stored in the metadata. but for some reason, CSV data is not binding with the correct record/document in DataMapper. I tried applying the condition that compares the ‘accntnmbr’ first in the csv and metadata document; if matching, then update the other fields for that record in the metadata document.
for (i = 1; i < idxField.length; i++) {
if ( idxNo[i] != -1 ) {
if (oMetaData.job().group(0).document(src_seq-1).FieldByName('_vger_fld_accntnmbr').toString() == strCSVData[0]) {
oMetaData.job().group(0).document(src_seq - 1).fields.add2('_vger_fld_' + idxField[i], strCSVData[idxNo[i]], 0);
}
}
}
one records data is updating for another record or so. Is there any mistake in the code?
I have written this code by actually referring to the different forum answers and solutions.
I would appreciate any help on this. Thanks