Boolean function
Applies to:
Canvas apps
Desktop flows
Model-driven apps
Power Pages
Power Platform CLI
Converts a text string, number, or untyped value to a Boolean value.
Use the Boolean function to convert other types to a Boolean value. A Boolean value is true, false, or blank.
In most cases, type coercion happens automatically and the Boolean function need not be used explicitly. For example, If( "true", 1, 0 )
will return 1 as the text string "true"
is automatically converted to a Boolean. The Boolean function is useful when an explicit conversion is desired or when using an untyped value.
Boolean( String )
Boolean( StringSingleColumnTable )
- String - Required. The string(s) to convert. Must be a case insensitive version of
"true"
or"false"
. These strings aren't localized. blank and empty string is also accepted and converted to a blank. All other text strings return an error.
Boolean( Number )
Boolean( NumberSingleColumnTable )
- Number - Required. The number(s) to convert.
0
is converted to false and all other numbers are converted to true. blank values are accepted and converted to a blank.
Boolean( Untyped )
- Untyped - Required. The untyped value to convert. Acceptable values are dependent on the untyped provider. For JSON, JSON boolean values
true
,false
, andnull
are accepted, corresponding to true, false, and blank values in Power Fx. String or number values are accepted as outlined for the String and Number overloads described earlier.
Formula | Description | Result |
---|---|---|
Boolean( "true" ) | Converts the text string "true" to a boolean value. |
true |
Boolean( "false" ) | Converts the text string "false" to a boolean value. |
false |
Boolean( "TRUE" ) | Converts the text string "TRUE" to a boolean value. |
true |
Boolean( "TrUe" ) | Converts the text string "TrUe" to a boolean value. |
true |
Boolean( "Truthful" ) | Attempts to convert the text string "Truthful" to a boolean value, but since it isn't a case insensitive variation of true and false , an error is returned. |
error (invalid argument) |
Boolean( Blank() ) | Convert the blank value to a boolean value. | blank |
Boolean( 0 ) | Convert the number 0 to a boolean value. |
false |
Boolean( 1 ) | Convert the number 1 to a boolean value. |
true |
Boolean( -1234 ) | Convert the number -1234 to a boolean value. |
true |
Formula | Description | Result |
---|---|---|
Boolean( ParseJSON( "{ ""bool"": true }" ).bool ) | Converts the untyped value true (a JSON Boolean) to a boolean value. |
true |
Boolean( ParseJSON( "{ ""bool"": null }" ).bool ) | Converts the untyped value null (a JSON null) to a boolean value. |
blank |
Boolean( ParseJSON( "{ ""bool"": "true" }" ).bool ) | Attempts to convert the untyped value "true" (a JSON string) to a boolean value, but since it isn't a valid boolean value in JSON, an error is returned. |
error (invalid argument) |
Boolean( ParseJSON( "[ true, false, null ]" ).bool ) | Attempts to convert an array of boolean values to a single column table. Single column tables aren't supported with untyped values, and instead the formula ForAll( Table(ParseJSON( "[true, false, null]" )), Boolean( ThisRecord.Value ) ) or ForAll( ParseJSON( "[true, false, null]" ), Boolean( ThisRecord ) ) should be used. |
error (invalid argument) |
Formula | Description | Result |
---|---|---|
Boolean( [ "true", "false", Blank() ] ) | Converts the single column table of text strings to a single column table of boolean values. | [ true, false, blank ] |
Boolean( [ "true", "falsified" ] ) | Converts the single column table of text strings to a single column table of boolean values. Since the second record in this table isn't a case insensitive variation of true and false , an error is returned for this record. |
[ true, error (invalid argument) ] |
Boolean( [ 1, 2, 0 ] ) | Converts the single column table of numbers to a single column table of boolean value. | [ true, true, false ] |