GetAsBoolean()
Syntax: GetAsBoolean ( data ) |
Parameters:
dataAny text, number, date, time, timestamp, or container, or a string containing text, a number, date, time, timestamp, or container.
Data type returned: Number
Description:
Returns a 1 if the expression or data passed into the function is not zero nor empty, otherwise zero and null values return 0.
GetAsBoolean() is somewhat different than the also common test not IsEmpty ( data ). The important distinction is that a GetAsBoolean() test will treat zero as a false result.
Examples:
Function |
Results |
---|---|
GetAsBoolean ( myField ) where myField = "hello": |
Returns 1. |
GetAsBoolean ( myField ) where myField = -1000: |
Returns 1. |
GetAsBoolean ( myField ) where myField = 0: |
Returns 0. |
GetAsBoolean ( myField ) where myField is empty: |
Returns 0. |