Setting Boolean (True/False) Fields using ModelBuilder


Product(s): WaterCAD, WaterGEMS, SewerGEMS, SewerCAD, StormCAD, PondPack, CivilStorm, HAMMER
Version(s): V8 XM and V8i SELECTseries , CONNECT Edition
Area:  N/A


This tech-note is meant to help with confusion about how ModelBuilder can be used to set boolean fields.

Setting Boolean (True/False) fields using ModelBuilder 

There are a few different ways these fields can be set using ModelBuilder. The setting somewhat depends upon whether you are updating a model or if the you are creating a new model.

Creating a New Model

If you are creating a new model you will be using an excel spreadsheet, shapefile(s), DXF(s), or some other data source to tell ModelBuilder how to build your model. There are 2 ways that work well if you need to set a boolean field during your ModelBuilder run. Both need to be performed before you run ModelBuilder. 

    1)   Adding a column with 0's and 1's

    I.   Add an integer column to your data source that contains either 0's for False or 1's for True. See screenshot below for an example.



    II.   When you get to the object mapping step of the ModelBuilder wizard, map this field to the boolean field in the   program. (e.g. The field in your data source that contains the binary values is called Tru_Fals. You would map this field to the boolean field you want to set.) In the screenshot below, Tru_Fals is mapped to "Has User Defined Length?".


     III.   If the setting boolean field will expose or makes another field active, as in the example above, map sure to map it too.

NOTE: If you aren't sure if another field will be exposed or made active the best way to find out is to open a model and change the properties of that field in the specific element for which it is applicable. 


    2)   Creating a prototype

    I.    By creating a prototype, you can configure the default values for any new element that is created from that point forward. Prototypes can be accessed from "View" off the main menu bar.

NOTE: If you are not familiar with how to set up a prototype, the included Help documentation provides a good explanation. You can find this specific help document for prototypes by doing a search for the help document titled "Using Prototypes". If the search option in Help is not exposed you should click the first icon at the top of the help page which should say "Show".

    II.   Once a prototype has been created you can then run ModelBuilder without having to worry about setting the boolean fields. However, if some elements should be true (checked) and others false (unchecked), you will need to use method #1 described further above.


Updating an Existing Model

If you are just updating elements in a model that already exist with ModelBuilder, the best way that I have found to set the boolean fields is by doing a global edit on the element's flextable. There are two situations which you may encounter if you are updating an existing model: 1) Updating all elements 2) Updating just selected elements

    1) Updating all elements

     I.   Open the flextable for the element who's boolean value field you want to set.

    II.   If the field that you want to edit is not already in the flextable, add it to the actively displayed fields using the 'Edit' icon     located at the top of the flextable.

    III.   Once the field is added, right click on the boolean column and select 'global edit' from the context menu. Set the field to either true or false.

    IV.   Run ModelBuilder

    2) Updating selected elements

    I.   Select only the elements that you want to change the boolean field for by using one of the selection methods such as, point and click, building a query, or selection by polygon. 

    II.   Once the elements are selected, create a selection set by right clicking in the drawing pane and selecting 'Create Selection Set' from the context menu.

    III.   With the elements still selected (highlighted) in the drawing pane go to 'View'  from the main menu toolbar and pick flextables {or hold CTRL + 7}. This should open the flextable manager window. In this window right click on the flextable that you are going to be setting the boolean field for and select  'Open on Selection'. This should open the flextable with only the elements that you have highlighted in the drawing pane shown.

    IV.   Follow steps I - IV above under 'Updating all elements'. 


See Also

Building a Model Using Model Builder

Updating a Model Using Model Builder

Product TechNotes and FAQs

OpenFlows Product Tech Notes And FAQs


External Links

Hydraulics and Hydrology Forum

Bentley SELECTservices

Bentley LEARN Server