I have previously posted a question on this but had no response.
I need to record the serial number of a part when necessary. This requires a data transaction to 2 tables. This is my code. It doesn’t error but it also doesn’t record anything. Any advice at all would be appreciated
if (initialValuesHaveChanged()){
var taskTrans = generateDataTransaction("part_usage", "INSERT","");
taskTrans = addToDataTransaction(taskTrans, "task_id", taskId);
taskTrans = addToDataTransaction(taskTrans, "part_id", partId);
taskTrans = addToDataTransaction(taskTrans, "part_line_code", line_code);
taskTrans = addToDataTransaction(taskTrans, "line_code_type", line_type);
taskTrans = addToDataTransaction(taskTrans, "quantity", quantity);
var taskTrans2 = generateDataTransaction("part_usage_serial", "INSERT","");
taskTrans2 = addToDataTransaction(taskTrans, "serial_id", serial);
saveDataTransaction(taskTrans, "Save Part Used Entry");
saveDataTransaction(taskTrans2, "Save Part Used Serial Entry");
alert("Part usage successfully saved");
goToScreen("PartUsedEntryVTH", true);
return true;
}
If I remove the second data transaction I get an error saying
“The number of serial IDs selected does not match the quantity.”
How do you go about sending data to 2 tables to avoid this error?