Skip to main content
Nintex Community Menu Bar

If, And, Or

  • May 15, 2020
  • 2 replies
  • 8 views

Forum|alt.badge.img+1

Hi

I am some trouble with a formula. I want to configure a text box to have a specific amount of numbers when another choice field is used. So far I have the below but its not working.

 

When the Entity choice field is populated I want the account number to have a specific amount of digits

 

Any help would be much appreciated

 

=IF(OR(AND(Entity="Entity 1",LEN(AccountNumber=14),AND(Entity="Entity 2",LEN(AccountNumber=11),AND(Entity="Entity 3",LEN(AccountNumber=8),AND(Entity="Entity 4",LEN(AccountNumber=8)))))),"Valid","Invalid")

2 replies

Forum|alt.badge.img+6
  • Rookie
  • May 15, 2020

Hi.

try this one

if((Entity == "Entity1" && lenght(AccountNumber) == 14) || (Entity == "Entity2" && length(AccountNumber) == 11) || (Entity == "Entity3" && length(AccountNumber) == 8) || (Entity == "Entity4" && length(AccountNumber) == 8), "Valid", "Invalid")

 

If you don't know, "&&" is AND; "||" is OR; == is EQUAL TO

Hope this helps


Forum|alt.badge.img+6
  • Rookie
  • May 15, 2020

Update:

If you are going to use this with a validation rule, this is what it should be:

 

(Entity == "Entity1" && lenght(AccountNumber) != 14) || (Entity == "Entity2" && length(AccountNumber) != 11) || (Entity == "Entity3" && length(AccountNumber) != 8) || (Entity == "Entity4" && length(AccountNumber) != 8)