Logical Tool "If Value Is"

3963
13
Jump to solution
03-25-2019 12:39 PM
BruceJohnson
New Contributor II

Could someone show me how to configure the Model Builder logical tool "If Value Is"?

I am trying to use it in exactly the same way as shown in the documentation with no luck.  My model has a Boolean parameter, just as the example below, which when checked at the start should produce a "true", unchecked a "false".  I can't figure out the settings for the tool itself to evaluate a true/false, yes/no question.  What would the settings be to make the model from the documentation, shown below, function?

0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor

In my model if I uncheck the parameter Is this it? I get the following result. It seems to work for me. Honestly I didn't expect it to work because normally setting something to zero or false makes it a false precondition, but with this tool it is working for me. This new If Value Is tool is new for Pro and works around this problem which makes the true/false branching more complicated in ArcMap.

Executing (If Value Is): ValueIsIfThenElse false "Is equal to at least one value" "Case insensitive string" true # #

Start Time: Thursday, April 4, 2019 8:52:34 AM

Succeeded at Thursday, April 4, 2019 8:52:34 AM (Elapsed Time: 0.00 seconds)

Executing (Calculate Value): CalculateValue "This Is It" # Variant

Start Time: Thursday, April 4, 2019 8:52:34 AM

The process did not execute because the precondition is false.   <-- expected from branching.

Succeeded at Thursday, April 4, 2019 8:52:34 AM (Elapsed Time: 0.00 seconds)

Executing (Calculate Value (2)): CalculateValue "*This is not it*" # Variant

Start Time: Thursday, April 4, 2019 8:52:34 AM

Value = *This is not it*

Succeeded at Thursday, April 4, 2019 8:52:34 AM (Elapsed Time: 0.00 seconds)

Just to make sure we are on the same page, here is my If Value Is setup. The variable "List of values (true)" is a model element I created of type Any Value, set to true (no quotes)

If Value Is example

View solution in original post

13 Replies
curtvprice
MVP Esteemed Contributor

Have you tried the text representation of a boolean true: "true" (without the quotes)

0 Kudos
BruceJohnson
New Contributor II

Not sure I understand what you mean.  Where would I try that?

0 Kudos
curtvprice
MVP Esteemed Contributor

In the model below "Is this it?" is a Boolean variable created with the Variable button from the ribbon, then connected to If Value Is, selecting the parameter Input value.

I then connected True and False outputs as precondition to further processing depending on whether "Is this it?" was set to true (checked) or false (unchecked).

If Value Is Model Builder Example

Executing (If Value Is): ValueIsIfThenElse true "Is equal to at least one value" "Case insensitive string" true # #

Start Time: Saturday, March 30, 2019 9:03:21 AM

Succeeded at Saturday, March 30, 2019 9:03:21 AM (Elapsed Time: 0.00 seconds)

Executing (Calculate Value): CalculateValue "This Is It" # Variant

Start Time: Saturday, March 30, 2019 9:03:21 AM

Value = This Is It

Succeeded at Saturday, March 30, 2019 9:03:21 AM (Elapsed Time: 0.00 seconds)

Executing (Calculate Value (2)): CalculateValue "*This is not it*" # Variant

Start Time: Saturday, March 30, 2019 9:03:21 AM

The process did not execute because the precondition is false.

Succeeded at Saturday, March 30, 2019 9:03:21 AM (Elapsed Time: 0.00 seconds)

0 Kudos
BruceJohnson
New Contributor II

Thanks for your help so far Curtis.  This has gotten me a little further along, but I'm still having trouble. Setting up things exactly as you have above, the model is successful when the Boolean variable is set to "true", but mine is not working if the variable is set to "false".  The following results;

Can you confirm if your model behaves the same way?

0 Kudos
curtvprice
MVP Esteemed Contributor

In my model if I uncheck the parameter Is this it? I get the following result. It seems to work for me. Honestly I didn't expect it to work because normally setting something to zero or false makes it a false precondition, but with this tool it is working for me. This new If Value Is tool is new for Pro and works around this problem which makes the true/false branching more complicated in ArcMap.

Executing (If Value Is): ValueIsIfThenElse false "Is equal to at least one value" "Case insensitive string" true # #

Start Time: Thursday, April 4, 2019 8:52:34 AM

Succeeded at Thursday, April 4, 2019 8:52:34 AM (Elapsed Time: 0.00 seconds)

Executing (Calculate Value): CalculateValue "This Is It" # Variant

Start Time: Thursday, April 4, 2019 8:52:34 AM

The process did not execute because the precondition is false.   <-- expected from branching.

Succeeded at Thursday, April 4, 2019 8:52:34 AM (Elapsed Time: 0.00 seconds)

Executing (Calculate Value (2)): CalculateValue "*This is not it*" # Variant

Start Time: Thursday, April 4, 2019 8:52:34 AM

Value = *This is not it*

Succeeded at Thursday, April 4, 2019 8:52:34 AM (Elapsed Time: 0.00 seconds)

Just to make sure we are on the same page, here is my If Value Is setup. The variable "List of values (true)" is a model element I created of type Any Value, set to true (no quotes)

If Value Is example

BruceJohnson
New Contributor II

>>The variable "List of values (true)" is a model element I created of type Any Value, set to true (no quotes)

That was it Curtis. I did not have the value set as a model element. Setting it that way has things working correctly. Many thanks for the help.

JakubSisak
Occasional Contributor III

Thank You!  What a weird implementation. I can confirm this answer works but needs to be setup exactly as specified in the answer. However, I am still getting the very unhelpful message warning " The process did not execute because the precondition is false." I whish there was an option to supress the warning in this instance because no matter what one or the other branch will not execute because the whole purpose is to execute one of 2 branches based on the condition. I initially tried to set the Is Value Is with Comparison Type: Automatic detection and Values set to the Boolean parameter (checkbox in the tool) but it was always evaluating to True never executing the False condition branch.   

JakubSisak_0-1630073830762.png

 

JakubSisak_1-1630073854277.png

 

JakubSisak_2-1630073921092.png

 

0 Kudos
StephenM
Occasional Contributor II

Try putting true in the "Values" field. Note that it will create an Any Value variable pointing to the If Value Is tool, so it'll look a little different from the diagram.

0 Kudos
Joseph_Kinyon
Occasional Contributor II

Curtis,

Have you had success with this since you sought help here?
We have had similar challenges with our model recently and troubleshooting it has been difficult and cannot discern if It is behaving as designed and our logic is circular or if it is giving unexpected results for other reasons.
It stumped my tech support for similar reason and they are testing it.

0 Kudos