Method Directive Condition question

,

I’m trying to make a Method directive that will look at a PN being entered and when they attempt to save it if Track Lots and Track SN is not checked off it will then see if the PN is in a specific Part Class and then raise an exception if it is saying one of the two are required.

I’ve gotten this to work fine with the Track Lots and Track SN fields in one condition window and I was attempting to use a second condition to exclude part classes from this rule. Come to find out there are more classes excluded than included, so I switched gears to make the second condition based on the class.

Is there ANY way that I can put one condition line in there to see if a field is in a list of the following and then raise the exception? Or do I have to list each one separately using the “The ttPart.ClassID field of the changed row is equal to the “SP” expression.”

I’ve tried making the expression of the above condition be “SP || FG || FGF”, that syntax is accepted and || is the “or” command, but it does not work and will not search those three entries like a list.

For this type of situation, I write C# for the condition. If you know how I would recommend that.

There is the one option in the condition widget where you design a query and then your condition is usually based on if the query returns any rows. Within the query designer, you can see if ttPart.ClassID is in a constant list. You can then specify (in double quotes) all the classes you want it to include.

I don’t know C# which is the reason why I’m asking how to do this. My BPM writing knowledge is limited to using canned conditions looking at individual fields and typically 1 or 2 variables. I’ve never gone to C# classes or BPM classes for Epicor.

I’ve never used a query in a BPM before and my knowledge on how to write BPM’s is very limited. I’d need much more info on how to set this up to proceed with your suggestion.

This should work

2 Likes

Exactly what I was thinking.

My version of Epicor makes me enter each of those lines surrounded in double quotes. Same thing if I am entering a constant value that is a string. It won’t yell at me while I am entering it, but when I go to save the BPM, it will error out.

@dr_dan I went as far as validating and it did not error, but I never ran it so you could be right if it throws an error. It seems sometimes when I leave them off the quotes get magically added in the background.

I always thought it was strange because in the BAQ designer, I don’t have to use quotes. But I do when I use the query designer within the BPM. Now I am just used to it. Fool me once, shame on you… Fool me twice… hehe

1 Like

That’s a good suggestion but as noted above, I’ve never input a query into a BPM, so I don’t know how the workflow should look to set that up properly. I’d need more info to try this.

I understand how to setup the BAQ criteria, and in all honestly I wish the BPM criteria had the same options as the BAQ’s since the “in” operation with “Constant list” would solve all my issues

pick this condition everything else is in the picture. That constant list is the IN you want and the rest is BAQish. If it throws an error on saving wrap the part classes in quotes.

image

Tried the suggested and get this when trying to save the BPM. The query creation went fine, and the workflow validated fine. It will save as long as it’s not enabled. I will be back at this tomorrow.

image

There is at least one compilation error.
Update.Pre.Lot_or_Serial_Re.cs(66,48): error CS0103: The name ‘False’ does not exist in the current context
Update.Pre.Lot_or_Serial_Re.cs(67,53): error CS0103: The name ‘False’ does not exist in the current context
Update.Pre.Lot_or_Serial_Re.cs(68,32): error CS0103: The name ‘SP’ does not exist in the current context
Update.Pre.Lot_or_Serial_Re.cs(68,36): error CS0103: The name ‘FG’ does not exist in the current context
Update.Pre.Lot_or_Serial_Re.cs(68,40): error CS0103: The name ‘FGF’ does not exist in the current context

in BPMs you have to use double-quotes " in the BAQ designer. It’s weird but that’s probably what’s going on.

Can you upload a screen shot of the condition and possibly the bpm?

I’m walking out the door but I’ll post this up to bake till tomorrow. The only problem I see with this is shouldn’t the part they are working on or saving be a driving filter on the query? That way if that part fits those conditions then it’s present on the query making the statement of “is more or equal to 1” accurate? Because right now if I just run the designed query with that criteria then it’s always going to have a row since some currently exist this way.

I am going to test also, but to your point this is only on the ttPart data so it is only the row you are saving.

In my version I had to use double quotes on the list and a constant of lowercase false. I threw in our 0000 class to test it.

image

1 Like

This shows my inexperience in using a query in a BPM.

That did the trick!

Thank you for the assistance in this… Also now knowing how to use a query like this may have opened up a new realm of making BPM’s… Currently we have very few since I’m not overly versed in writing them and I’m the only one maintaining the system so the less I have to worry about during upgrades the better :wink:

1 Like

This is coming back to haunt me in the field. I noticed it when I was trying to mass update a few PN’s with track lots that were not enabled before. I was using the DMT and it popped up with my exception saying Track Lot’s or Track SN needs to be enabled to continue. The below is what I have discovered on how it works or how it doesn’t… I was always creating a new part when testing this logic, I never tried to update an existing one that was currently not tracked.

If I bring up a PN that currently is not Lot or SN tracked, check off Track Lots and click save, it will error out and not let me continue.

The only time it appears to work is when I am creating a NEW PN it will stop me if Lot tracking or SN tracking is not selected and after you do check it off and click save it will continue without issue.

What gives?

@FTI-SeniorAdmin The logic is good, but changing tracking lots or serial numbers or costing method has to be done on a part with with no on hand quantity and sometimes in a particular order. IE Lot FIFO costing can’t be applied unless Lot tracking is on and can’t be changed to FIFO unless lot tracking is turned off first.

Anytime I have done mass updates to lot tracking I have had to first prepare a quantity adjust DMT run to remove the quantities and then another to put them back after.