Remove Results from Grid (Kanban Receipts - Lot Tracked Materials

Hi

Seeing a post earlier today about removing results from search - has prompted me to ask this question. I checked whether the same method was relevant to this form, but it appears not.

I would like to remove entries from this screen which are not in warehouse = CU.

[/uploads/default/original/2X/1/1f69d1ce89cf2f71f65e6f1f19a222354937c54b.png]

Doing a trace, I think the searching and present is all wrapped up within the KanbanReceipts.PreProcessKanbanReceipts method.

Can I use C# code to iterate through the rows in the ttLotPartBin temporary table, and delete the ones that I don’t want?

Many Thanks
Mark

Your image link doesn’t work - it should be this:

Thanks Caleb – I started the post from an email. Wonder if Jose see’s this and knows why that wouldn’t work first time?

Sure just iterate through the ttResults in post processing and remove the ones you don’t want

-Jose

Can you hand hold me a bit more on this one please – still teaching myself C#. Something like…

foreach (var lotPart in ttLotPartBin)
{
// Delete rows where Warehouse Code <> CU
this.PublishInfoMessage(“test” + lotPart.LotNum, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, “Lot Materials”, “Delete”);

}

Testing the above, I don’t even get the message popup.

Thanks!
Mark

Is your code set to run async?

No, its in the default of sync.

The method I previously posted didn’t show the message box,
Moving it to validatelowerlevel… on Post Proc works with this:

foreach (var lotPart in ttLotPartBin)
{
// Delete rows where Warehouse Code <> CU
this.PublishInfoMessage(“test” + lotPart.LotNum, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, “Lot Materials”, “Delete”);
}

just need the syntax for deletions…

thanks
mark

Change your foreach to a forloop and count backwards (Long story but if you are removing from within a foreach it’ll trigger a logic error, “You can’t modify the collection while iterating”)

for(int i= ttLogPartBin.Count; i>=0; i--)
{
         ttLogPartBin[i].Delete();
}
1 Like

Hi Jose

Got the loop bit identifying the rows that I need. When trying to delete using the below code you supplied, I get:

System.Drawing.Bitmap CS7036 There is no argument given that corresponds to the required formal parameter ‘entity’ of ‘IceDataContextExtensions.Delete(ObjectSet, T)’

So I think I’m reading that I need to pass an object to the Delete() method, but what object?

Many Thanks
Mark

Ok, finally got it working after pestering a friendly contact at Epicor.

Used the for loop that you provided @josecgomez, but needed a different method to delete.

ttLotPartBin.Remove(ttLotPartBin[i]);