Hi everyone,
i have a problem to update a record that i fetched via QueryRun. I call 'selectForUpdate(true)' on the table buffer before updating but it doesn't seem to have an effect.
The error is classical:
Cannot edit a record in Configuration element (FWPPBATreeNode).
The operation cannot be completed, since the record was not selected for update. Remember TTSBEGIN/TTSCOMMIT as well as the FORUPDATE clause.
The table i want to update is inner-joined to the "main" table (FWPPBATable).
treeBomQbds = pbaTableQbds.addDataSource(tableNum(FWPPBATreeBOM), tableStr(FWPPBATreeBOM));
treeBomQbds.joinMode(JoinMode::InnerJoin);
treeBomQbds.relations(false);
treeBomQbds.addLink(fieldNum(FWPPBATable, RecId), fieldNum(FWPPBATreeBOM, PBATable));
treeBomQbds.addRange(fieldNum(FWPPBATreeBOM, DataAreaId)).value(itemRange);
ttsbegin;
while (qr.next())
{
pbaTable = qr.get(tableNum(FWPPBATable));
treeBom = qr.get(tableNum(FWPPBATreeBOM));
finishedGood = qr.get(tableNum(FWPPBATreeFinishedGood));
// search for PBA's that have one route only
select count(RecId) from treeOpr
where treeOpr.PBATable == pbaTable.RecId;
if(treeOpr.RecId == 1)
{
oldPbaTable = FWPPBATable::find(treeBom.FWIPBATablePreProd);
prePbaTable = this.findValidPBA(treeBom);
if (prePbaTable.RecId != oldPbaTable.RecId)
{
treeBom.selectForUpdate(true);
treeBom.FWIPBATablePreProd = prePbaTable.RecId;
treeBom.update();
}
}
}
ttscommit;
Any ideas on this?
Regards,
Nils
*This post is locked for comments
I have the same question (0)