Filter by currently selected material in Engineering workbench?

So I am trying to create a simple BPM that will set the estimated scrap rate when you assign material to an operation in the engineering workbench. I want to base it on the operation (laser, and plasma get 20% Router gets 24%, the rest can be 0%)

I have a post processing Method directive tied to the Erp.EngWorkBench.ChangeECOMtlRelatedOperation. It fires when I want it to, which is when the related operation is changed. I also figured out how to set the field EstScrap to a number. What I’m having problems with is specifying what the number should be base on the operation. Since the ttECOMtl table only has the related op number (10, 20, etc.) you can’t tell what it’s supposed to be because of that. So I added a condition that looks for a query line count of one for a defined query where I tied the ttECOMtl to the ECOOpr table and filtered by operations.I would have tied it to the ttECOOpr table, but that always comes back as 0.

It kind of works except that it the TTtable keep more that just the current record in memory, so as you start changing to different materials and flipping the related ops on different material, the count isn’t 1 anymore, it’s more than one. After saving and refreshing a bunch of times I can get it to change to what I want, but then it soon breaks and is filling out number based on receiving 1 row back when it should be receiving 0 back.

I would like to filter out by only the material that’s selected on the screen, is that possible without custom coding? I feel like I am missing something simple.

Thanks for your help. If you have one of those LMGTFY let me have it, because I tried googling but I couldn’t find anything relevant.

Brandon