dperani
Scholar

Need to make 2 fields mandatory IF first character of another field is a letter

Jump to solution

I have three fields: BusUnit, SLType and SLNo

I need to write code or rule that will check the first character of "BusUnit" and if it is a Letter then it makes the "SLType" and "SLNo" fields mandatory.

 

Is this possible?

0 Kudos
Reply
4 Replies
SimonMuntz
Nintex How-To Center Expert
Nintex How-To Center Expert

Re: Need to make 2 fields mandatory IF first character of another field is a letter

Jump to solution
Hi. Add this rule to SLType and SLNo

not(isNumeric(subString(BusUnit,0,1))) && isNullOrEmpty({Self})

What it does: The subString function grabs the fist letter of what is in the control BusUnit. Then checks if its a number using the isNumeric function. If its not a number then its a letter so returns false but the NOT then reverses that to make it true.
then if SLType is also empty it makes the whole rule true which invalidates the control.
Add the same rule to SLNo.
Reply
dperani
Scholar

Re: Need to make 2 fields mandatory IF first character of another field is a letter

Jump to solution

Thank you Simon Muntz!

What if the first character is not a number or a letter (shouldn't be) ?  I am thinking it was then make the 2 field mandatory even though it is not a letter.  I don't want them to be able to type any special characters either.  Just A-Z or a-z or 0-9,  That should be a RegEx expression validation for field as well, correct?

0 Kudos
Reply
dperani
Scholar

Re: Need to make 2 fields mandatory IF first character of another field is a letter

Jump to solution

I added the rules but they don't seem to be working.  I have attached my form.

0 Kudos
Reply
SimonMuntz
Nintex How-To Center Expert
Nintex How-To Center Expert

Re: Need to make 2 fields mandatory IF first character of another field is a letter

Jump to solution
{Self} is a token that you will find in the named controls. You have just typed it in.
Use Self or the actual name of the control.
0 Kudos
Reply