Hi everyone,
I’m trying for the first time to bring detail records from a second CSV file into a detail table.
So far, I’ve managed to load them into a JSON field using the following script:
(function () {
var path = ‘*\\Loan_Details.csv’;
var r = openTextReader(path, 'Windows-1253’);
if (!r) return '[]’;
var mainCRS = String(record.fields['CRS'] || '').trim();
var out = [];
var line;
while ((line = r.readLine()) != null) {
if (!line) continue;
var p = line.split('~’);
if (p.length < 11) continue;
var CRS = String(p[0]).replace(/^\uFEFF/, '').trim();
if (CRS !== mainCRS) continue;
out.push({
CRS: CRS,
ArDaneiou: String(p[1]).trim(),
ArSymvasis: String(p[2]).trim(),
EidosDaneiou: String(p[3]).trim(),
IdiotitaParalipti: String(p[4]).trim(),
KodikosPliromis: String(p[5]).trim(),
Kefalaio: String(p[6]).trim(),
Tokoi: String(p[7]).trim(),
Exoda: String(p[8]).trim(),
SynoloOfeilis: String(p[9]).trim(),
EidosEpistolis: String(p[10]).trim()
});
}
r.close();
return JSON.stringify(out);
})();
How can I turn this JSON field into a proper detail table inside the DataMapper?
Although I assume there must be an easier or more direct way to achieve this that I’m missing.
Thanks in advance for any guidance!
Akis