Skip to main content
Nintex Community Menu Bar

Help with a Calculated value

  • May 17, 2019
  • 6 replies
  • 28 views

Forum|alt.badge.img+1

Hi,

 

I need to create a calculated value using IF where it involves 2 fields, where when either the outgoing State of the document, or the back State is of a specific value, let it of a value of 4, when it is not, in these 2 fields, which is 2.

 

I try to use this:

 

If(StateC||StateD==("Mato Grosso"||"Mato Grosso do Sul"), 4, 2)

 

Unsuccessfully!

 

Can someone help me?

 

Thank You!

Rafael

6 replies

Forum|alt.badge.img+5

Hi @Rechag 

 

Try:

 

If(or(StateC=="Mato Grosso", StateD=="Mato Grosso do Sul"), 4, 2)


Forum|alt.badge.img+1
  • Author
  • May 17, 2019
But i have to use "Mato Grosso do Sul" in StateC, and "Mato Grosso" in StateD.
I have to use contains?

Forum|alt.badge.img+11
  • Nintex Employee
  • May 17, 2019

Hi Rechag,

 

I think the issue you're seeing here is your order of operations with your bitwise operators.  From your comment it looks you're checking to see if StateC equals Mato Grosso or if StateD equals Mato Grosso do sul.  When looking at your original statement:

 

StateC||StateD == ("Mato Grosso" || "Mato Grosso do Sul")

 

The Parenthetical would execute first, then the ==, lastly the remaining ||.  So efectively you would be evaluating if StateC  or (StateD equals (Mato Grosso or Mato Grosso do Sul)).  Note that StateD is evaluated against the values but StateC is not.

 

I'm guessing you're looking for something along the lines of:

 

if((StateC == "Mato Grosso" ) || (StateD == "Mato Grosso do Sul"),4,2)


Forum|alt.badge.img+11
  • Nintex Employee
  • May 17, 2019

Sorry one additional comment on the above.

 

If you're trying to check if either of the two fields has either of the two values then you'd need to expand the statement to include the additional boolean checks:

 

if((StateC == "Mato Grosso" ) || (StateC == "Mato Grosso do Sul" ) || (StateD == "Mato Grosso" )|| (StateD == "Mato Grosso do Sul"),4,2)


Forum|alt.badge.img+5

@Rechag wrote:
But i have to use "Mato Grosso do Sul" in StateC, and "Mato Grosso" in StateD.
I have to use contains?

Just switch the values:

 

If(or(StateC=="Mato Grosso do Sul", StateD=="Mato Grosso"),4,2)

 

or using the other syntax:

 

if((StateC == "Mato Grosso do Sul" ) || (StateD == "Mato Grosso"),4,2)


Forum|alt.badge.img+1
  • Author
  • May 20, 2019
Hi, Brent

It's working! Thanks for all the support!