cancel
Showing results for
Did you mean:
Highlighted
Nintex Newbie

## Help with a Calculated value

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

Labels: (1)

6 Replies
Nintex Newbie

## Re: Help with a Calculated value

Hi @Rechag

Try:

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

Highlighted
Nintex Newbie

## Re: Help with a Calculated value

But i have to use "Mato Grosso do Sul" in StateC, and "Mato Grosso" in StateD.
I have to use contains?
Highlighted
Nintex Employee

## Re: Help with a Calculated value

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)

Highlighted
Nintex Employee

## Re: Help with a Calculated value

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)

Highlighted
Nintex Newbie

## Re: Help with a Calculated value

@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)

Highlighted
Nintex Newbie