hello everyone, i need help here
I have made a button in Inventory Management > Periodic > Transfer Orders > Lines
which deletes the Inventory Transactions which is not Reserve Physical (when partial) here is the picture:
I have this code to delete the Not Reserved Physical (on order):
void clicked()
{
InventTransOrigin inventTransOrigin;
InventTrans inventTrans;
ttsBegin;
{
select forUpdate inventTrans
join inventTransOrigin
where inventTrans.InventTransOrigin == inventTransOrigin.RecId
join InventTransferLine
where inventTransOrigin.InventTransId == InventTransferLine.InventTransId
&& inventTrans.StatusIssue != 4
&& InventTransferLine.TransferId == InventTransferTable.TransferId;
inventTrans.delete();
}
ttsCommit;
super();
InventTransferLine_ds.refresh();
InventTransferLine_ds.executeQuery();
}
--------
when i run this, the table becomes blank, it looks like this:
so I close and open it again, and the Table Data shows up, and the On Order is now removed ( meaning the Delete Code Works, but the Data does not Refresh in the Table)
Now, what I need is to Refresh the Table Data of the Form after the Deleting, (the Datasource is InventTransferLine_ds)
Please help me, thanks.
*This post is locked for comments
Hi Bhaskar Roy!
forupdate is important because im getting error when i didnt put it,
so I used your code and put forupdate in there:
void clicked()
{
InventTransOrigin inventTransOrigin;
InventTrans inventTrans;
ttsBegin;
{
select forupdate inventTrans
join inventTransOrigin
where inventTrans.InventTransOrigin == inventTransOrigin.RecId
//join InventTransferLine
&& inventTransOrigin.InventTransId == InventTransferLine.InventTransId
&& inventTrans.StatusIssue != 4
&& InventTransferLine.TransferId == InventTransferTable.TransferId;
if ( inventTrans)
{
inventTrans.delete();
}
}
ttsCommit;
super();
InventTransferLine_ds.refresh();
}
and now its working! thanks!
hi Hariharan,
i tried using your suggestion, but nothing happened,
all lines are gone, but after closing and opening it again, it will be back up again.
and the Delete Inventory is still working.
I just can't seem to refresh the data.
Why forupdate is required.
why are selecting InventTransferLine, it is in your scope.
Please try with below code and check.
void clicked() { InventTransOrigin inventTransOrigin; InventTrans inventTrans; ttsBegin; { select inventTrans join inventTransOrigin where inventTrans.InventTransOrigin == inventTransOrigin.RecId //join InventTransferLine && inventTransOrigin.InventTransId == InventTransferLine.InventTransId && inventTrans.StatusIssue != 4 && InventTransferLine.TransferId == InventTransferTable.TransferId;
if ( inventTrans)
{ inventTrans.delete();
} } ttsCommit; super(); InventTransferLine_ds.refresh();
}
Only you want to delete inventtrans, why not InventTransferLine. is there any specific reason .
Please call the refresh after the execute query.
InventTransferLine_ds.executeQuery();
InventTransferLine_ds.refresh();
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156