...No olvide TTSBEGIN/TTSCOMMIT y la cláusula FORUPDATE.
So, how do you update with queryRun? This link solved my issue, however there was a niggling feeling that it wasn't the optimum solution available. Here's an alternative suggestion:
/// Deselect (deactivate) all budget forecasts asociated with the project,
/// as it has just been cancelled.
public void EVE_wfCancelOperationDeactivateBFs(ProjId _projId)
{
Query query;
QueryRun queryRun;
QueryBuildDataSource qbds;
ProjForecastCost pfcTable;
;
query = new Query();
qbds = query.addDataSource(tableNum(ProjForecastCost));
qbds.update(true);
qbds.addRange(fieldNum(ProjForecastCost, ProjId)).value(QueryValue(_projId));
queryRun = new QueryRun(query);
while ( queryRun.next() )
{
pfcTable = queryRun.get(tableNum(ProjForecastCost));
ttsBegin;
//pfcTable.selectForUpdate(true);
pfcTable.Active = NoYes::No;
pfcTable.update();
ttsCommit;
}
}
Instead of calling the selectForUpdate(true) on the table buffer each time in the loop, we have it applied on the datasource qbds.update(true), which to me is more satisfactory.
No hay comentarios:
Publicar un comentario