How to update with queryRun?

Hi All,

i have created one method as shown below,

void FilterProductionOrder(str 20 _prodPoolDate,

str 10 _prodPoolId, boolean update = false)

{

Query query = new Query();

QueryBuildDataSource qbdsprodTable = query.addDataSource(tableNum(ProdTable));

QueryRun queryRun;

;

info("Date: " + _prodPoolDate + "PoolName: "+ _prodPoolId);

qbdsprodTable.addRange(fieldNum(ProdTable,SchedDate)).value(queryValue(_ProdPoolDate));

queryRun = new QueryRun(query);

startLengthyOperation();

while (queryRun.next())

{

prodTable = queryRun.getNo(1);

info (strFmt(“PoolId : %1 SchDate: %2”, prodTable.ProdPoolId,

prodTable.SchedDate));

ttsBegin;

prodTable.ProdPoolId = _prodPoolId;

ttscommit;

}

endLengthyOperation();

}

here i want to update Production Pool as i have written,

ttsBegin;

prodTable.ProdPoolId = _prodPoolId;

ttscommit;

MY AIM IS " while fetching record which has date mention in “_prodPoolDate”, that all should be assigned to Production pool mention in “_prodPoolId” "

Above code is executing without error. but not gives desired result.

Pls. replay as soon as possible.

Thank You in Advance.

Regards,

Mehul Thacker

ttsBegin;

prodTable.selectForUpdate(true);

prodTable.ProdPoolId = _prodPoolId;

ttscommit;

before any update you should select the record buffer for updating.///this may be a problem

Hi

qbdsprodTable.update(true); //set the queryBuildDatasource forupdate

ttsbegin;

while (queryRun.next())

{

prodTable = queryRun.getNo(1);

info (strFmt(“PoolId : %1 SchDate: %2”, prodTable.ProdPoolId,prodTable.SchedDate));

prodTable.ProdPoolId = _prodPoolId;

prodTable.update();

}

ttscommit;

Hi,

Thanks for replay

if i merge content from both of yours answers like,

ttsBegin;

prodTable.SelectForUpdate(true);

prodTable.ProdPoolId = _prodPoolId;

prodTable.Update();

ttscommit;

then it works fine.

Sorry I forgot to include the statement - ProdTable.update();

Any way it got solved.