Logical Tool "If Value Is"

4025
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
13 Replies
curtvprice
MVP Esteemed Contributor

This worked for me, and someone marked my answer correct so I think this issue was resolved. Feel free to continue the thread if you have a question on this tool.

Joseph_Kinyon
Occasional Contributor II

Thanks for confirming this.
We were using integer and tried a couple tools including this to create a stop point in the middle of the model.
We noodled with it this morning and our model was using it to create a dissolved shapefile of selected parcels in a zipped file that is to be submitted (via upload) as an area of interest to online reporting tools created by other agencies.

Many of those have a minimum threshold (varies) of acres for the report to run.

When the user selects the parcels of interest they are copied into memory, dissolved, and then the combined area is calculated.

If larger than user defined minimum acres, then the tool proceeds. If less, then that is used as a precondition and the model stops.

The "If Value Is" tool worked for us when we finally used it in conjunction with the "Get Field Value" on the final dissolved feature create in the prior step.

Using that that previously calculated value to compare to the user defined minimum was the true false expression condition we wanted.
Connecting directly to that caused the odd behavior while inserting the Get Field Value too removed the hangups.

It has worked like a charm stopping/continuing the model this way.

I now need to add a meaningful message to the user when it completes the model or not.

0 Kudos
curtvprice
MVP Esteemed Contributor

I have used the Calculate Value tool to calculate a string (including line feeds as chr(12) as the Calculate Value tool does not play with with \n).

"@@@Report line 1@Data {}@Report line 3@@@".format(value).replace("@", chr(12))‍‍

You could use precondition or If Value Is to control whether this thing executes or not.

 

The result comes out in the user messages as 

 

VALUE =


Report line 1
Data 2345.3435
Report line 3


‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

 

The alternative is to write a messaging Python script but I think it is nifty you can do it within the ModelBuilder tool. Should sure like a messaging tool built-in.

curtvprice
MVP Esteemed Contributor

@BruceJohnson  was the OP here, not me. If things aren't working as expected, going to tech support is great -- that is the only way things can get fixed. Esri can't fix anything that is broken without a use case and a reproducible example that demonstrates the problem. I know it can be a pain to get a bug logged but we ALL benefit when we users take the time to do it well.  I have had pretty good luck with this newish tool in ModelBuilder, though I still sometimes do it the "old way" (with Calculate Value returning a true or false value). I was helping someone with the If tool last week and it was working great (Pro 2.8).

0 Kudos