Transform Templates - Boolean

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

 


 

 User interfaces for the Transform pane have been changed.  See the Transform Reference topic for guides to new interfaces while this topic is updated.   Although this topic is now out of date, since many of the new transform templates are similar to templates detailed in this topic, reviewing the former versions of transform templates described in this topic will provide useful insight in addition to the shorter descriptions given in the Transform Reference topics.  

 


 

Many of the transform templates that generate a Boolean result are equivalent to analogous transforms in the Select pane: that makes sense, since a whether or not a condition tested, such as whether an object is an area or not, is true or false, is the same as testing if something should be selected (true) given a condition or not selected (false).

Tables, Boolean Types

Date Year Leap

Appears when the target field is a boolean data type.  Given a source field that is a datetime field, reports true or false whether the year in the datetime is a leap year.

 

 

We start with a table that has a datetime field and a boolean field.  

 

 

Choosing the boolean field as the target, the Date Year Leap transform appears in the list of templates.  For the Date field we choose the datetime field.

 

 

The preview shows how for each date the transform reports, true or false, whether it is a leap year.   This transform uses the DateTimeYearLeap  SQL function.

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.

 

Preview: Put in Temp_Boolean the result of Equal comparing A_Boolean and B_Boolean.

Preview: 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.

 

Preview: 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 Editing Drawings 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.

 

Preview: 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.  The Compare to value can be specified either by a field or by choosing Expression and then entering a number.

 

 

Preview: Put in Temp_Boolean the result if Numbers is Greater than Fractions.

Note the result for the fifth record is false since being equal is not the same as being greater than.

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.

 

Preview: Put in Temp_Boolean the result if Numbers is Greater or Equal than Fractions.

Note the result for the fifth record is true since being equal meets the condition of being greater than or equal to.

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.

 

 

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.

 

 

Preview: Find the JSON Boolean for the name NonCoin within the field JSON_Info and put it into the boolean field  Bool.   We have first chosen Value from the pull down list for Name and then entered NonCoin.  Note that no quotes are used to set off the NonCoin string.

The JSON string for the first record contains a boolean true value for NonCoin:

 

{ "Site": "Krinkberg", "NonCoin": true, "Photo": false }

 

The template therefore places true into the value of Bool for the first record.

 

 

Preview: Find the JSON Boolean for the name Photo within the field JSON_Info and put it into the boolean field  Bool.

Considering the JSON string for the first record:

 

{ "Site": "Krinkberg", "NonCoin": true, "Photo": false }

 

The template therefore places false into the value of Bool for the first record.

 

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.

 

Preview: 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.

 

Preview: 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.  The Pattern (%_) box includes a reminder in the form of the (%_) part of the caption that wildcards as can be used with the SQL LIKE Operator may be used within the pattern.

 

 

Preview: Put in Temp_Boolean the result if Comment2 is Like the pattern Menhir.  No quote characters are used around the string Menhir.

Limit

An abstract way to approach comparison of Boolean values, considering TRUE as 1 and FALSE as 0.  

 

Limit the result at both the low end and also the high end, to no less than the limiting value in the At least field and also to no more than the limiting value in the At most field.  Save the Value field into the result,  unless that is below the At least field, in which case the At least field value is saved into the result, or unless that exceeds the At most field, in which case the At most field value is saved into the result.  Another way of looking at this is to take the Value field if it falls between the At least and At most fields, inclusive.   Yet another way is to consider simultaneously the At least field as the floor and the At most field the ceiling for what is taken from the Value field.

 

Since there is no Boolean value "between" 1 and 0, the only Boolean values, when the At least and At most fields are Boolean data types, the Limit transform is limited in utility.  

Limit High

A somewhat abstract way to approach comparison of Boolean values, considering TRUE as 1 and FALSE as 0.

Limit the result at the high end, to no more than the limiting value in the At most field.  Save the Value field into the result, unless that exceeds the At most field, in which case the At most field value is saved into the result.  Another way of looking at this is to take the minimum of the Value field or the At most field.  Yet another way is to consider the At most field the ceiling for what is taken from the Value field.

The result of the above is to put a FALSE or 0 into the boolean target field if either of the two boolean source fields is FALSE or 0 and otherwise put a  TRUE or 1 into the target.  This is the equivalent of a logical AND gate.

 

 

Preview: Put in Temp_Boolean the result of Limit High comparing A_Boolean as the Value and B_Boolean as the At most field.

Limit Low

A somewhat abstract way to approach comparison of Boolean values, considering TRUE as 1 and FALSE as 0.

 

Limit the result at the low end, to no less than the limiting value in the At least field.  Save the Value field into the result, unless that is below the At least field, in which case the At least field value is saved into the result.  Another way of looking at this is to take the maximum of the Value field or the At least field.  Yet another way is to consider the At lease field the floor for what is taken from the Value field.  

 

The result of the above is to put a TRUE or 1 into the boolean target field if either of the two boolean source fields is TRUE or 1 and otherwise put a FALSE or 0 into the target.  This is the equivalent of a logical OR gate.

 

 

Preview: Put in Temp_Boolean the result of Limit Low comparing A_Boolean as the Value and B_Boolean as the At least field.

Non-null Values

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.

 

Preview: Put in Temp_Boolean the result of Non-null Values for Comment2.

Normalized Geoms

When normalizing geometry Manifold sets a flag to alert any subsequent processes the object has already been normalized.   This template checks the internal flag to see if geom values have been normalized.  If so, put a TRUE or 1 into the boolean target field and if not, put a FALSE or 0 into the target.

 

Preview: Put in Temp_Boolean the result of Normalized Geoms applied to Geom.  None of the objects in the drawing have yet been normalized.

 

We open the drawing, we select three objects and then we run the Normalize template with the Restrict to selection option checked.  That normalizes only the three selected objects.

 

Clicking on the table to move the focus to the table, we click the Normalize Geoms template to see that the geometry for three selected records (which correspond to the three objects we selected in the drawing) has been normalized.

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.

 

Preview: Put in Temp_Boolean the result of Not Equal comparing A_Boolean and B_Boolean.

Preview: 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.

Null Values

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.

 

Preview: Put in Temp_Boolean the result of Null Values for Comment2.

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.

 

 

Preview: Put in Temp_Boolean the result of Text Contains applied to Comment using the text des.  No quote characters are used to set off the des string.

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.

 

 

Preview: Put in Temp_Boolean the result of Text Ends with applied to Comment using the text es.  No quote characters are used to set off the es string.

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.

 

 

Preview: Put in Temp_Boolean the result of Text Contains applied to Comment using the pattern .*de.*.  No quote characters are used to set off the regular expression .*de.* string.

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.

 

 

Preview: Put in Temp_Boolean the result of Text Sounds like applied to Comment2 using the text menhere.  No quote characters are used to set off the menhere string.

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 useful. This example shows a useful match even though 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.

 

 

Preview: Put in Temp_Boolean the result of Text Starts with applied to Comment using the text Dolmens.  No quote characters are used to set off the Dolmens string.

Text Starts with, Intl

Same as Text Starts with but with optional specification of the language used.

 

See Also

Transform

 

Transform Pane

 

Transform Reference