OpenBI Docs Buy

Logical.FromText

Reads the text true or false, in any mix of capitals, as a logical.

Group: Values, types and errors. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Logical.FromText(text as nullable text) as nullable logical
ParameterTypeDescription
textnullable textThe text "true" or "false"; null gives null.

Returns

nullable logical. true or false.

Remarks

  • Spaces, tabs and line breaks around the word are ignored; an empty text, or one of white space only, gives null.
  • Any other text, such as "yes" or "1", is an Expression.Error: map those with an if or a Table.ReplaceValue first.
  • Only text is taken: a number is an error here, where Logical.From reads it.

Examples

Capitals don't matter

Logical.FromText("False")
false

Not a logical

Logical.FromText("yes")

Result: an error.

[Reason = "Expression.Error", Message = "We couldn't convert to Logical.", Detail = "yes"]

Logical.From, Logical.ToText.

Last updated · OpenBI Studio 0.3.79