← cast operator page · general/cast/boolean_to_string/true_and_false
pandas ✅ · DuckDB ✅
cast(Me_1, string) on a Boolean measure, an implicit conversion written as an explicit cast, whose "behavior remains the same".
Type conversion: "From boolean to string: Either one of the string values "true" and "false" is returned, depending on the input."
true gives the string true and false gives false, in lower case as the manual writes them; a string is compared exactly.
DS_r := DS_1[calc Me_2 := cast(Me_1, string)];
| Id_1 | Me_1 |
|---|---|
| 1 | true |
| 2 | false |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Boolean", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | true | true |
| 2 | false | false |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Boolean", "role": "Measure"},
{"name": "Me_2", "type": "String", "role": "Measure"}
]
}
]
}