BPM For Key field in UD table

,

I am needing to create a BPM that will make UD16.Key2 only allow Integers.

Should be very easy to achieve with pre processing bpm on update then using int.TryParse result to validate

Never used, or knew of, int.TryParse. so I’m guessing something like UD16.Key2 is equal to the expression int.TryParse(UD16.Key2)equals true.

you can use Regex which does validation according to rules you define… The following value will be TRUE if input is all digits (the \d is checking for digits). The understand Regex, you can go to https://regexr.com/ and put the regex string “&\d+$” into the tester and then type various answers and it will tell you if it is good or bad.

string input = "123";
Bool valueIsNumeric = Regex.IsMatch(input, @"^\d+$");
//this will be true
string input = "123a";
Bool valueIsNumeric = Regex.IsMatch(input, @"^\d+$");
//this will be false

The format is:

bool successful = Int32.TryParse(string? s, out int result)

If successful evaluates to true then it was able to parse the string as an integer.

2 Likes