Delete row in dataset in bpm

Hi all,
I want to add some additional filtering in the PO suggestions : before the ‘generate PO’ runs, I want to delete some rows from the datatablel ttSugPoDtl.
Do you have a clue/example how to do that?
I have tried something like “ttSugPoDtl.Delete(ttSugPoDtlRow);” within a foreach, but I get the errormessage “SugPoDtlTable does not contain a definition for delete…”

Regards,
John

Not sure you want to go down that path. I would offer you filter it afterward while searching.
Try this:

1 Like

Hi Jason,
Thanks for your reply.
I’m afraid that filtering during the search is not possible, since the filtering is done IN the Generate method of the POSugg business object.
So as far as I can see, I will have to do something after the filtering has been done (post-processing of Generate method). There I can delete the obsolete rows in ttSugPoDtl table.

Then a data directive may be needed. I would need more details as to your business case to make a better recommendation.

Jason Woods
http://LinkedIn.com/in/jasoncwoods

The goal is to create PO’s only for the current user (not buyer, but user).
-when user sets a suggestion to ‘Buy’, I store his/hers userid in a UD-field

  • when generating the PO’s, the user gets the question if only PO’s should be created for suggestions of this user.
  • then only the suggestions of this user should be processed into PO’s.

So, how could a data-directive help me in this?

Cheers,
John

So when the dataset comes into the “Generate PO” process, does it have this information? If so, you can delete using the code provided in that link.

Jason Woods

Owner | Jason Woods Consulting

jason@jasonwoods.me | Cell: 360.903.4893

www.linkedin.com/in/jasoncwoods

http://jasonwoods.me

The post-processing of the Generate contains the filled dataset (that needs my new filtering).

I will try the code provided in the link and I’ll let you know if it works.

Cheers,
John

Hi Jason,
I tried, but I get an error message when running.
Since there is no ttSugPoDtlList, I have modified the statement into :

foreach ( var ttSugPoDtlRow  in 
         ( from row in ttSugPoDtl
           select row)) 
{                 
    ttSugPoDtl.RemoveAll(ttSugPoDtl => ttSugPoDtlRow.UDField<string>("BuyByUser_c") != Session.UserID);      
}

When I generate, I get the following error :
Collection was modified; enumeration operation may not execute.

I think you may have overcomplicated it… in your case, you might be able to simplify this to one line:

ttSugPoDtl.RemoveAll(x=> x.UDField<string>("BuyByUser_c") != Session.UserID);  

This “RemoveAll” does all the work… inside the parenthesis it does the search, and removes any that meet your criteria from the tt table. (NOTE, i have NOT Tried this)

1 Like

So the pre-processing does not have a dataset?

I do processing on Posugg.GetRowsPlant, so I hung @timshuwy’s code on this method post processing and it does clear any records in the select from the tt table presented to the buyer. they are still in the data just not presented for the user to check buy on.

I am confused by the Buyer versus User. If you only want records for the current user regardless of buyer then you could update the BuyerID on the record marked buy with the current user. Then the Epicor processing would take over.
If you have a user that generates for several buyers then you could set the buyer id and use your UD table to set them back in post generation to the actual buyer. @josecgomez has a “way” to find those POs after generation that I used this week to transfer settings.

Hi Tim,
Your line of code works.
Unfortunately, it does not add to the solution.
The pre-processing of the Generate has no dataset yet, the post-processing has already processed the dataset.
So I am now working on a solution based on the comments of Greg.
Thank you all for thinking along !

Cheers,
John

Hi John,

Did you get a working solution on this? I have created a BPM to block users entered a PO manually when they are not the buyer on the Part but I am now looking at stopping them from seeing entries in the POSuggestions after an MRP where they are not the buyer.

Thanks

Matt