Check if Character field is numeric in BPM

We have an unusual case where we have a nvarchar field that we are using as a numeric. If anyone put in something that is not a number it blows up a query. We are wanting to put a bpm in place to check if the orderdtl.shortchar01 value is numeric. If not to throw up a message and not allow.

I know if we just added another field and made numeric would be the right way to go but since this table is used for EDI all our mappings would have to be redone (Hours and hours) so we are trying to use what is available.

We tried using the IsNumeric() function but Epicor does not seem to like it.

You could use decimal.TryParse(… , …) which returns a true/false AND the converted value (if it’s convertible).

Here’s a set arg/var widget that uses it. It sets a boolean variable (isNumber) and a decimal variable (number) to the parsed field (Employee ID field).

So are there 2 variables in there IsNumber (Booleen or Booleen? type) and number (Decimal or Decimal? Type

When I put the information in there with just the IsNumber variable the word number does not seem to be recognized.


Right, i created 2 variables isNumber (boolean) and number (decimal).

Okay. I got it to validate. I am now testing.


If you use int.TryParse(...) it will limit it to integers.

PN just int


PN with Decimal

(note that IsInt is false)

Non Int or Dec

If you want to exclude negatives, replace any leading - with an X) before calling <type>.TryParse()

If you need numbers bigger than want an Int can hold, use Long
expression for IsULong:

 (long.TryParse(BpmFunc.Replace(dsPartRow.PartNum,"-","X"),out tmpLong)) ?  true  :  false 


Yeeee Haaaa !!! It worked. Thanks so much !!! I had not used variables in BPMs before. Just learned a little more.


1 Like