Servoy 3.5.3
I am having a problem with copyMatchingColumns() overwriting the PK of the destination record, which if I understand the documentation correctly it is not suppose to do this?
I have the following code…
( I have autoSave = false because all PK’s are db identity)
var new_carton_foundset = databaseManager.getFoundSet(controller.getServerName(), 'carton');
var new_carton_record = new_carton_foundset.getRecord(new_carton_foundset.newRecord(false, true));
databaseManager.saveData();
databaseManager.copyMatchingColumns(current_carton_record, new_carton_record, true);
for (i=1; i <= current_carton_record.fk_carton_item_to_carton.getSize(); i++) {
current_ci_record = current_carton_record.fk_carton_item_to_carton.getRecord(i);
new_carton_record.fk_carton_item_to_carton.newRecord(false, true);
databaseManager.saveData();
new_ci_record = new_carton_record.fk_carton_item_to_carton.getRecord(new_carton_record.fk_carton_item_to_carton.getSelectedIndex());
databaseManager.copyMatchingColumns(current_ci_record, new_ci_record, ['carton_item_quantity', 'id_carton']);
}
Now if i put a breakpoint right before the databaseManager.copyMatchingColumns(current_ci_record, new_ci_record, [‘carton_item_quantity’, ‘id_carton’])) I see the PK for new_ci_record equal to something like ‘DbIdentValue3099306’, after the copyMatchingColumns() it gets set to the value of the current_ci_record PK, also column ‘carton_item_quantity’ gets copied over into new_ci_record even though it should have been excluded (id_carton does seem to get excluded)