Rechag
Canvas Initiate

Help with a Calculated value

Jump to solution

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

0 Kudos
Reply
6 Replies
cherylshah
Workflow Hero

Re: Help with a Calculated value

Jump to solution

Hi @Rechag 

 

Try:

 

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

0 Kudos
Reply
Rechag
Canvas Initiate

Re: Help with a Calculated value

Jump to solution
But i have to use "Mato Grosso do Sul" in StateC, and "Mato Grosso" in StateD.
I have to use contains?
0 Kudos
Reply
brent_read
Nintex Employee
Nintex Employee

Re: Help with a Calculated value

Jump to solution

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)

0 Kudos
Reply
brent_read
Nintex Employee
Nintex Employee

Re: Help with a Calculated value

Jump to solution

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)

View solution in original post

0 Kudos
Reply
cherylshah
Workflow Hero

Re: Help with a Calculated value

Jump to solution

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

0 Kudos
Reply
Rechag
Canvas Initiate

Re: Help with a Calculated value

Jump to solution
Hi, Brent

It's working! Thanks for all the support!
0 Kudos
Reply