DatabaseColumn.BooleanValue

From Xojo Documentation

Revision as of 01:32, 2 February 2022 by Gperlman (talk | contribs) (Sample Code)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Property (As Boolean )
aDatabaseColumn.BooleanValue = newBooleanValue
or
BooleanValue = aDatabaseColumn.BooleanValue

New in 2019r2

Supported for all project types and targets.

Used to get and set the values of Boolean field types.

Notes

The values "0" and "False" are treated as False and "1" and "True" are treated as True. The behavior of any other values is undefined when retrieved using BooleanValue. Use StringValue to retrieve the original values in the field.

Sample Code

For situations where you need to set a database column to NULL, you should use the Value property like this:

rs.EditRow
rs.Column("MyBooleanColumn").Value = Nil // sets to NULL in the database
rs.SaveRow

Get the boolean value of a column in a RowSet:

// rs is a RowSet with a boolean column called "AllowEmails"
If rs.Column("AllowEmails").BooleanValue Then
MessageBox("Emails are allowed.")
End If

Set the boolean value of a column in a RowSet:

// rs is a RowSet with a boolean column called "AllowEmails":
rs.EditRow
rs.Column("AllowEmails").BooleanValue = True
rs.SaveRow