Hi Marcel,
you need to create the line in the table by calling the function .createItem() on the Table. You then fill the new line item and push it to the table via push on the tables
Here is an example how i like to do that specifically. I tend to put such stuff in configs ans write the code more generically but i hope it is still readable for you.
//load simple tables
$.log.info(LOG_PREFIX + ' start loading simple tables');
var simpleTablesToLoad = config.tablesToSync;
for (tableNameDms in simpleTablesToLoad) {
if (Object.hasOwnProperty.call(simpleTablesToLoad, tableNameDms)) {
var tableLoadConfig = simpleTablesToLoad[tableNameDms];
var colMap = tableLoadConfig.colMap;
if (dmsObject.data[tableNameDms]) {
$.log.info(LOG_PREFIX + ' loading table ' + tableNameDms);
var targetTable = $.variable(tableLoadConfig.wfName);
targetTable.value = [];
dmsObject.data[tableNameDms].forEach(function (element) {
var item = targetTable.createItem();
item.value = {};
for (dmsColKey in colMap) {
if (Object.hasOwnProperty.call(colMap, dmsColKey)) {
var wfColKey = colMap[dmsColKey];
item.value[wfColKey] = element[dmsColKey];
}
}
targetTable.value.push(item);
});
}
}
}
a corresponding config for my usecase could look like:
var config = {
//the tables that must be synced between dms and wf
tablesToSync: {
tlistecontainernummern: {
wfName: 'tabContainerNumbers',
colMap: {
stcontainernummer: 'sContainerNummer',
stcontainertyp: 'sContainerTyp',
stforwardingreference: 'sForwardingReference',
},
},
},
};