﻿ Transform Templates - Boolean

# Transform Templates - Boolean

This topic discusses application of the Transform Dialog with Tables on a Boolean field in a table.  See the Transform Dialog and Transform Templates topics for use and for links to lists of templates for other data types for tables and use of the Transform Dialog with other components, such as Drawings and Images.

### Tables, Boolean Types

 And Performs an AND operation on the source fields and puts the result into the target field.     Example: Put in Temp_Boolean the result of Binary And using A_Boolean and B_Boolean. Areas If the geom in the source field contains an area put a TRUE or 1 into the boolean target field.  If not, put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Areas examining Geom. Between If the source field value is between the specified upper and lower bounds, inclusive, put a TRUE or 1 into the boolean target field and if not equal put a  FALSE or 0 into the target.  The upper and lower bounds can be specified either by a field or by entering a number.   Example: Put in Temp_Boolean the result if Numbers is Between the lower bound of Fractions and the upper bound of 12468.   Note that in the fourth record the value of 12468 is equal to the upper bound specified so for that record Numbers is considered Between the lower bound of the value in Fractions and the specified upper bound of 12468. Copy Copy the source field into the target field.   Example: Copy A_Boolean into Temp_Boolean. Equal Compare the two source fields.  If equal put a TRUE or 1 into the boolean target field and if not equal put a  FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Equal comparing A_Boolean and B_Boolean. Example: Put in Temp_Boolean the result of Equal comparing Comment and Comment2. The Equal template works on all data types, such as two boolean fields in the first example and two nvarchar fields in the second example.  Because the result is a boolean it requires a boolean type as the target in the table and thus is listed in the Boolean templates for tables.  Note also that if one of the two source fields is a NULL, that is, not a determinable value, the result also is not determinable, a NULL. Geoms with Curves If the geom in the source field contains a curved segment put a TRUE or 1 into the boolean target field.  If not, put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Geoms with Curves examining Geom. In the fifth record above, a geom specifying a line, the line object contains at least one curvilinear segment so a boolean True or 1 is written into the target for that record. None of the other objects are defined using any curvilinear segments so for those records a boolean False or 0 is put into the target.  See the New Object Dialog topic. Geoms with Z If the geom in the source field contains a Z value put a TRUE or 1 into the boolean target field.  If not, put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Geoms with Z examining Geom. In the table above those records with a geom specifying an area also contain a Z value so a boolean True or 1 is written into the target for those records. None of the other objects are defined with a Z value so for those records a boolean False or 0 is put into the target. Greater If the source field is greater than the comparison field put a TRUE or 1 into the boolean target field and if not greater put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result if Numbers is Greater than Fractions. Greater or Equal If the source field is greater than or equal to the comparison field put a TRUE or 1 into the boolean target field and if not greater or equal put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result if Numbers is Greater or Equal than Fractions. Is not NULL If the source field does not contain a NULL put a TRUE or 1 into the boolean target field and if not put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Is not NULL for Comment2. Is NULL If the source field contains a NULL put a TRUE or 1 into the boolean target field and if not put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Is NULL for Comment2. JSON Boolean A means to extract boolean values that are embedded into JSON strings as the boolean value for a named JSON entity.  Scan the source field to find the specified name and if it exists and has a boolean value put the value into the target field.   Example: Find the JSON Boolean for the name 'NonCoin' within the field JSON_Info and put it into the boolean field  Temp. Example: Find the JSON Boolean for the name 'Photo' within the field JSON_Info and put it into the boolean field  Temp. The example table above has a field called JSON_Info that contains JSON strings which provide information about archaeological sites, for example, whether there are photos of the site and whether items other than coins were found at the site.   The JSON string for the first record above is:   { "Site": "Krinkberg", "NonCoin": true, "Photo": false }   Some of the named entities have boolean values and some have string values.  Using the JSON Boolean template we can extract boolean values for those entities that have boolean values.   See the Example: Construct JSON String using Select and Transform topic for an example creating the table illustrated above. Less If the source field is less than the comparison field put a TRUE or 1 into the boolean target field and if not less put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result if Numbers is Less than Fractions. Less or Equal If the source field is less than or equal to the comparison field put a TRUE or 1 into the boolean target field and if not less or equal put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result if Numbers is Less or Equal than Fractions. Like If the source field matches the Pattern put a TRUE or 1 into the boolean target field and if not put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result if Comment2 is Like the pattern 'Menhir'. Lines If the geom in the source field contains a line put a TRUE or 1 into the boolean target field.  If not, put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Lines examining Geom. Maximum Value Put a TRUE or 1 into the boolean target field if either of the two boolean source fields is TRUE or 1 and if not put a  FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Maximum Value comparing A_Boolean and B_Boolean. Minimum Value Put a FALSE or 0 into the boolean target field if either of the two boolean source fields is FALSE or 0 and if not put a  TRUE or 1 into the target.   Example: Put in Temp_Boolean the result of Minimum Value comparing A_Boolean and B_Boolean. Not Performs a NOT operation on the source fields and puts the result into the target field.   Example: Put in Temp_Boolean the result of Binary Not using A_Boolean. Not Equal Compare the two source fields.  If not equal put a TRUE or 1 into the boolean target field and if equal put a  FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Not Equal comparing A_Boolean and B_Boolean. Example: Put in Temp_Boolean the result of Not Equal comparing Comment and Comment2. The Not Equal template works on all data types, such as two boolean fields in the first example and two nvarchar fields in the second example.  Because the result is a boolean it requires a boolean type as the target in the table and thus is listed in the Boolean templates for tables.  Note also that if one of the two source fields is a NULL, that is, not a determinable value, the result also is not determinable, a NULL. Or Performs an OR operation on the source fields and puts the result into the target field.   Example: Put in Temp_Boolean the result of Binary Or using A_Boolean and B_Boolean. Points If the geom in the source field contains a point put a TRUE or 1 into the boolean target field.  If not, put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Points examining Geom. Text Contains If the source field contains a match to specified text put a TRUE or 1 into the boolean target field and if not put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Text Contains applied to Comment using the text 'des'. Text Contains, Intl Same as Text Contains but with optional specification of the language used. Text Ends with If the source field ends with the specified text put a TRUE or 1 into the boolean target field and if not put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Text Ends with applied to Comment using the text 'Vert'. Text Ends with, Intl Same as Text Ends with but with optional specification of the language used. Text Matches Regexp If the source field matches the specified regular expression put a TRUE or 1 into the boolean target field and if not put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Text Contains applied to Comment using the pattern '.*de.*'. The regular expression matches any sequence of zero or more characters followed by a de and then one or more characters of any kind.  For example, it matches any text value that has a de or a des somewhere in the text (but not a de at the very end).  The second and fourth records do not have a de anywhere so they result in a FALSE or 0 being put into the target. Text Sounds like If the source field sounds like the specified text put a TRUE or 1 into the boolean target field and if not put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Text Sounds like applied to Comment2 using the text 'menhere'. The template's function uses a Soundex algorithm to determine if the pronunciation of two text strings in English language would be similar despite slight variations in spelling.  Although intended for English it will frequently work well enough in some other languages to be somewhat useful, as in this example case where the contents of the source field are clearly in French language. Text Starts with If the source field starts with the specified text put a TRUE or 1 into the boolean target field and if not put a FALSE or 0 into the target.   Example: Put in Temp_Boolean the result of Text Starts with applied to Comment using the text 'Dolmens'. Text Starts with, Intl Same as Text Starts with but with optional specification of the language used. Xor Performs an XOR operation on the source fields and puts the result into the target field.   Example: Put in Temp_Boolean the result of Binary Xor using A_Boolean and B_Boolean.

Transform Dialog

Transform Options

Transform Templates

Transform Templates - Drawings

Transform Templates - Images

Transform Templates - Binary

Transform Templates - Datetime

Transform Templates - Geom

Transform Templates - Numeric

Transform Templates - Text

Transform Templates - Tile

Example: Two Drawings from the Same Table - Take a table with a geom field that is visualized by a drawing.  Add a second geom field to the table and create an rtree index on that field so it can be visualized by a drawing.   Copy the first drawing, paste it and adjust the pasted copy so it uses the second geom field. Demonstrate how to use the Transform dialog to show "live" modifications in the second drawing compared to the first drawing.

Example: Copy one Column into Another Column with Transform - How to use the Transform dialog to copy the contents of one column in a table into another column, but only for selected records.  Uses the Products table from the Nwind example data set.

Example: Transform Field Values using an Expression in the Transform Dialog -  How the Expressions tab of the Transform Dialog may be used to change the values of fields.   We include an example of changing the price of selected products and using two different Transform dialogs open at the same time for two different table windows.

Example: Construct JSON String using Select and Transform - Use the Select and Transform dialogs to manually construct a JSON string using values from other fields in a table. Shows how we can manipulate text to build desired contents in a field.

Example: Edit a Drawing with Transform Dialog Templates -  In this example we open a drawing and edit objects in the drawing using the Transform dialog Template tab.   Includes examples of using the Add Component button and also the Edit Query button.

Example: Use a Transform Dialog Expression to Create Buffers in a Drawing - Use the Expression tab of the Transform Dialog to create three different sizes of buffers for different lines in a drawing and then automatically create a query which does the same thing.  Includes examples of using the Add Component button and also the Edit Query button.

Example: Clip Areas with a Transform Dialog Expression - Use the Expression tab of the Transform dialog to clip areas in a drawing to fit within horizontal bounds.   Includes examples of using the Add Component button and also the Edit Query button.

Example: Smooth Lines with a Transform Dialog Expression - Use the Expression tab of the Transform dialog to make lines smoother in a drawing so that longer lines are smoothed more.  Includes examples of using the Edit Query button to show how different queries are created automatically depending on if we want to update a field or to add a new component.

Example: Transfer Options and Merge Areas - Using the Merge Areas Transform dialog template, an exploration of the difference between using Copy and Sum for transfer options.