Notifications
Announcements
No record found.
Hi Team,
I am using update_recordset but I am not getting expected result.
if (_inventValueExecutionHistory.MainAccountTypeEXP == NoYes::YES) { ttsbegin; update_recordset inventValueReportTmpLine setting mainAccountId = mainAccount.MainAccountId where inventValueReportTmpLine.TransactionId == _inventValueExecutionHistory.TransactionId join generalJournalEntry where generalJournalEntry.SubledgerVoucher == inventValueReportTmpLine.Voucher join generalJournalAccountEntry where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId join mainAccount where mainAccount.RecId == generalJournalAccountEntry.MainAccount; ttscommit; }
Is this query wrong? using the same query in while statement worked fine.However with this update_recordset query the mainAccountId field is getting updated with one value '1500' in all fields.
Thanks.
Hi P S,
you could try to get the translated SQL statement and ananlyze it.
This way you can see the actually executed SQL and compare it with the while select statement.
generateonly and info(inventValueReportTmpLine..getSQLStatement()) could be helpful
With kind regards,
Oliver
Hi Oliver, I tried with sql statement this query worked fine..but when I converted this query to update_recordset format..the data is not right..
My question is do we do update_recordset this way only?
I would also write it this way.
If I remeber correctly you can also aggregate the where clause, but this might me be even interpreted differently.
I would search somewhere different.
Could you please share you while select?
if (_inventValueExecutionHistory.MainAccountTypeEXP == NoYes::YES) { while select forupdate inventValueReportTmpLine where inventValueReportTmpLine.TransactionId == _inventValueExecutionHistory.TransactionId { select firstonly generalJournalEntry where generalJournalEntry.SubledgerVoucher == inventValueReportTmpLine.Voucher join generalJournalAccountEntry where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId join mainAccount where mainAccount.RecId == generalJournalAccountEntry.MainAccount; if (mainAccount) { ttsbegin; inventValueReportTmpLine.MainAccounId = mainAccount.MainAccountId; inventValueReportTmpLine.update() ttscommit; } }
Thanks for response Oliver. Above is the while statement for this query.
Sure, I hope could help you in the end and do not increase your workload even more.
Can you modify the while select according to my Code and analyse if it is still updating with different MainAccountIds or now also with only 1500.
ttsbegin; while select forUpdate * from inventValueReportTmpLine where inventValueReportTmpLine.TransactionId == _inventValueExecutionHistory.TransactionId join generalJournalEntry where generalJournalEntry.SubledgerVoucher == inventValueReportTmpLine.Voucher join generalJournalAccountEntry where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId join mainAccount where mainAccount.RecId == generalJournalAccountEntry.MainAccount { inventValueReportTmpLine.mainAccountId = mainAccount.MainAccountId, inventValueReportTmpLine.doUpdate(); } ttscommit;
Have you already used the debugger to find out if the input values for your update_recordset command are correct and if the correct SQL command is generated?
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 646 Most Valuable Professional
André Arnaud de Cal... 529 Super User 2025 Season 2
Sohaib Cheema 285 User Group Leader