Solved

BPM Condition contains wildcard?

  • 28 October 2022
  • 9 replies
  • 336 views

Userlevel 2

I've written a BPM that send up an exception when certain part numbers are entered on Sales Orders, based on our part number nomenclature. Unfortunately, over the years this nomenclature hasn't been strictly adhered to, so I'm having to get "extra" to exclude the correct parts and cannot get a wildcard to work correctly in a condition.

For example, a standard part number may be something like A1454C-3-CI, where the "-3-" refers to the part category. Those are easy to exclude. However, there's also ones like A1454C-3PBA-CI, so I'm trying to get it to trigger on part numbers that contain "-3%-", but that string doesn't work. It doesn't like my percent sign between the 3 and the dash. Works great in a BAQ, but can't get it to work in the BPM, even though it doesn't throw any syntax errors.

Is there a different wildcard that I should be using than % (already tried both * and ^ to no different results).

icon

Best answer by dinman 4 November 2022, 21:53

View original

9 replies

Userlevel 2

Are you writing this BPM in a custom code widget or are you using some other widget? When you say you got it to work in the BAQ, what was your criteria? I’m guessing you did a like comparison? 

Userlevel 2

You can use “contains” something like:

 

if (partNum.Contains(“-3-”))

{

}

Userlevel 2

I’m strictly using a Condition widget using the “specified field of the … row(s) contains the specific expression” option.

In my BAQ I used on the Part table the criteria PartNum LIKE %-3[a-z]%-% constant. I tried that particular expression in my BAQ, too, but it also didn’t work.

Userlevel 2

You can use “contains” something like:

 

if (partNum.Contains(“-3-”))

{

}

I have no problem finding the -3- instances. It’s the ones where I need to find ones that have a variety of alpha characters between the 3 and the last dash, e.g. -3PBA- I can’t get any sort of wildcard to work to correctly find those instances.

Userlevel 2

Did you try “matches” instead of contains? I have not tried this with wildcards in the expression, but give it a shot.

Userlevel 2

Yep, tried matches, too. Same result.

Userlevel 2

you might be able to create a boolean variable and set it in a widget using a LINQ statement… which should let you do a like statement similar to the one you did in the BAQ. 

 

I’m thinking something like:

(from t in ttOrderDtl

where t.PartNum like ‘%-3[a-z]%-%’

select t).Any()

Userlevel 3

Hi David,

Check out LEFT, RIGHT and SUBSTRING in SQL Server, perhaps scenario #7 can help.

Regards,

Userlevel 2

For those who may come across this in the future, this got me to the solution I needed:

 

BPM Condition phrases

Reply