E9 to E10 BPM Conversion

Have tried the online converter and searched many posts.
Need to filter out records after a lookup to Part to get CheckBox01 value. Seems simple but …

Need to filter out records from the Part system search button. In E9 , was able to delete a row
in Post Processing of GetList and GetById. In E10 , always run into errors… like cannot remove rows that am looping with For Each. Just can’t get the syntax right. Below is the E9 code. Anyone able to help translate to a working E10 code ? Thank You …

ORIGINAL

FOR EACH ttPartList:

FIND FIRST Part WHERE Part.PartNum = ttPartList.PartNum AND Part.CheckBox01 = True NO-ERROR.
IF AVAIL Part Then
DO:
DELETE ttPartList.
END.

END.

ps… I can get a error free save of the code, but get system errors on use … Working code would be greatly appreciated . Thank You .

Try something like this (untested) code:

  1. it loops through teh ttPartList
  2. it does an “any” query to see if the current row should be removed. This returns a True or False
  3. it removes the part if it needs removed.
foreach (ttp in ttPartList) {
    bool removeIt = Db.Part.Any(x=>x.Company == CompanyID && x.PartNum == ttp.PartNum && x.CheckBox01 == true)
    if (removeIt) ttp.RemoveAll(x=>x.PartNum == ttp.PartNum);
}

Can’t this be done with tweak to the WhereClause?

Like

Edit

Updated to reference a better post

Yes, However, you loose the builtin selection of search items like Áctive’ , unless the where clause is appended to. I haven’t been able to append successfully keeping all options…

thanks…

Put a Show Message widgit in there to see what is going on.

The following expression works for Part.GetList, when the search box has its own whereClause entries.

"PartNum LIKE '%-%'" + (whereClause.Length > 0 ? " AND " : " ") + whereClause

That adds a filter to only show parts with a dash in the PartNum.

Here’s the whereClause when the BPM first fires:

image

And Here it is after tweaking it:

image

Calvin,

Nice…

Thanks for that …

max