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
| Parameter | Type | Description |
|---|---|---|
text | nullable text | The 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
ifor aTable.ReplaceValuefirst. - Only text is taken: a number is an error here, where
Logical.Fromreads 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"]