Hi everyone !
I`m having some issue doing CUD (Create, Update, Delete) using relationship tables.
Everytime I do a request in those operations I get an error:
ERROR condition: Unable to call SAVE-ROW-CHANGES(). Failed to create query for BEFORE-TABLE. (7211)
Following code:
JSDO Class Update sample code ->
public update(record: progress.data.JSRecord, tableChild?: string) {
let childDataset: progress.data.JSTableRef = this._jsdo[tableChild] || null;
let promise = new Prom ise((resolve, reject) => {
let afterUpdate = (jsdo: progress.data.JSDO, record: any, success: boolean) => {
//ommited return resolve(data)
}
if (this._jsdo) {
this._jsdo.subscribe('AfterUpdate', afterUpdate, this);
if (childDataset) {
childDataset.assign(record)
} else {
this._tableRef.assign(record);
}
this.save().catch((err) => {
reject(err);
});
} else {
throw new Error("JSDO is not initialized.");
}
});
let result = Observable.fromPromise(promise);
return result;
}
Record code service =>
public update(record: any) {
let jsRecord = this.getById(record.Id);
jsRecord.assign(record);
return this._jsdo.update(jsRecord);
}
The Record arg is passing nested elements, but when I get the JSDORecord, just the data without the relationship.
My mainlly question is: I'm not sure what the backend expected as a payload
There's an example available?
Hi, Anil!
Thanks for your reply, helped a lot and it worked!