If Selection Exists (ModelBuilder)

Summary

Evaluates if the input data has a selection and if a certain number of records are selected.

Learn how If Selection Exists works in ModelBuilder

Usage

  • This tool does not make a selection or evaluate an SQL expression or where clause. It simply checks if a selection set matches a specified value. Use the Select Layer By Attribute tool to make a selection in ModelBuilder. Use the If Field Value Is logical tool to evaluate if the input dataset has records that match a SQL expression or where clause.

  • This tool is intended for use in ModelBuilder, not in Python scripting.

  • The tool has two Boolean outputs, True and False. Based on the condition being evaluated, one of the two Boolean outputs is true and the other is false after the tool runs. These Boolean outputs must be set as a precondition to the downstream tools for those to execute if either of the preconditions is true.

Syntax

arcpy.mb.SelectionExistsIfThenElse(in_layer_or_view, {selection_condition}, {count}, {count_min}, {count_max})
ParameterExplanationData Type
in_layer_or_view

Input layer or table view to evaluate.

Table View; Raster Layer; Mosaic Layer
selection_condition
(Optional)

Specifies the selection condition to be used for the field values of the records matching the SQL expression.

  • EXISTSChecks whether the field value exists for the records matching the SQL expression. This is the default.
  • NO_SELECTIONChecks whether none of the records matching the SQL expression are selected.
  • ALL_SELECTEDChecks whether all of the records matching the SQL expression are selected.
  • IS_EQUAL_TOChecks whether the field value of the records matching the SQL expression is equal to the count value.
  • IS_BETWEENChecks whether the field value of the records matching the SQL expression is between the minimum count value and maximum count value.
  • IS_LESS_THANChecks whether the field value of the records matching the SQL expression is equal to the count value.
  • IS_GREATER_THANChecks whether the field value of the records matching the SQL expression is greater than the count value.
  • IS_NOT_EQUAL_TOChecks whether the field value of the records matching the SQL expression is not equal to the count value.

String
count
(Optional)

The integer count value.

Long
count_min
(Optional)

The minimum integer count value.

Long
count_max
(Optional)

The maximum integer count value.

Long

Derived Output

NameExplanationData Type
true

If the specified criteria evaluates to True, this parameter will be set to True.

Boolean
false

If the specified criteria evaluates to False, this parameter will be set to True.

Boolean

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes