Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Boolean function

Applies to: 👁 Image
Canvas apps👁 Image
Copilot Studio👁 Image
Desktop flows👁 Image
Model-driven apps👁 Image
Power Platform CLI👁 Image
Dataverse functions👁 Image
Power Pages

Convert a text, number, or dynamic value to a Boolean value.

Description

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 you don't need to use the Boolean function explicitly. For example, If( "true", 1, 0 ) returns 1 because the text string "true" is automatically converted to a Boolean. The Boolean function is useful when you want an explicit conversion or when you use a dynamic value.

Syntax

Boolean( Text )
Boolean( TextSingleColumnTable )

  • Text - Required. The string(s) to convert. Must be a case insensitive version of "true" or "false". These text strings aren't localized. blank and empty text 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( DynamicValue )

  • DynamicValue - Required. The dynamic value to convert. Acceptable values depend on the dynamic provider. For JSON, JSON boolean values true, false, and null 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.

Examples

Basic usage

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() ) Converts the blank value to a boolean value. blank
Boolean( 0 ) Converts the number 0 to a boolean value. false
Boolean( 1 ) Converts the number 1 to a boolean value. true
Boolean( -1234 ) Converts the number -1234 to a boolean value. true

Dynamic usage

Formula Description Result
Boolean( ParseJSON( "{ ""bool"": true }" ).bool ) Converts the dynamic value true (a JSON Boolean) to a boolean value. true
Boolean( ParseJSON( "{ ""bool"": null }" ).bool ) Converts the dynamic value null (a JSON null) to a boolean value. blank
Boolean( ParseJSON( "{ ""bool"": "true" }" ).bool ) Attempts to convert the dynamic 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 dynamic 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)

Single column tables

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 values. [ true, true, false ]

Feedback

Was this page helpful?

Additional resources