The following example uses the If Expression Is tool to find business entities with or without mandated mask policy. Many business entities have mandated wearing masks to protect against COVID-19. If the False output variable is true (meaning the input data is not a shapefile), the model runs the top branch. If the input data is a shapefile, the True output variable and the precondition are set to true, allowing the bottom branch of multiple Add Field and Calculate Field tools to run. This model checks if the input data model parameter is a shapefile or feature class and processes the data accordingly. The If Data Type Is tool has two Boolean outputs: True and False. ![]() The following example uses the If Data Type Is tool to check the data type of the input dataset. If the True output variable is true (meaning the input dataset has the specified coordinate system), the model ends because no tools are connected to the True branch. If each feature class does not have a specified coordinate system, the False output variable and the precondition are set to true, allowing the Project tool to run. This model iterates over feature classes in a geodatabase and checks if each feature class has a particular projected coordinate system. The If Coordinate System Is tool has two Boolean outputs: True and False. The following example uses the If Coordinate System Is tool in ModelBuilder to check if a dataset has a certain coordinate system. If the False output variable is true (meaning no features are selected), the model ends as no tools are connected to the False branch. If the input has any selected features, the True output variable and the precondition are set to true, allowing the Summary Statistic tool to run. The If Selection Exists tool has two Boolean outputs: True and False. If Selection Exists is used after first running Selection Layer By Attribute. The following example uses the If Selection Exists tool to check if the input has any selected features and if so, the number of selected features. If the True output variable is true (meaning the field does exist), the model ends as no tools are connected to the True branch. If the field does not exist in the input dataset, the False output variable and precondition are set to true, allowing the Add Field tool to run. ![]() The If Field Exists tool has two Boolean outputs: True and False. ![]() The following example uses the If Field Exists tool to check if fields of a given name already exist in a dataset. If the False output variable is true (meaning the data does not exist), the model makes a copy of another dataset and runs the Calculate Field tool using this alternate dataset as input. If the input exists, the True output variable and the precondition are set to true, allowing the Calculate Field tool to run. The If Data Exists tool has two Boolean outputs: True and False. The following example uses the If Data Exists tool to check if the input features from a model parameter exist.
0 Comments
Leave a Reply. |