BPM Conditional Widget - Multiple OR statements

I’ve got a BPM that works, but was looking for input on a better way to code it. Can the Conditional block’s field input have a statement for multiple OR’s in one expression? I wasn’t able to get a (“KG” || “KO” || “KR” || “KS”) expression to work - it errored out on save, so I just added OR lines to the conditional block? Seems like one line of code could be better than 4 OR statements.

The objective is if a new or updated part is in one of four product groups, then set our truckload freight UD field to true and pop up a message.

Thoughts?

image

image

If you’re so inclined, you can use a custom code condition (as opposed to an expression)

1 Like

Dear Andris,
Instead of “equal to” you can choose “matches.” Perhaps a regular expression?
Best
…Monty.

Those widgets are useful but are a pain to use. There is no way to do what you want short of storing those values in a UD Table and using the condition where BAQResults >=… or as @Chris_Conn said custom code condition.

Chris, Monty, & Jose - Thanks for your input! I’ve really got to carve out some time to start learning C#. I’m a total noob there. For this one, I’ll leave well enough alone at the moment. It seems like an easy first project after some beginner C# lessons.

1 Like

Guys, couldn’t he just change “is equal to” to “matches” and change the expression from “KG” to “K[GORT]”? Is that oversimplifying?

8 Likes

Monty - Just tried that - it worked! Thank you. I’ll save this one in my beginner’s bag of tricks :slight_smile:

1 Like

Good one @MontyMan , I always forget that matches allows RegEx!

1 Like