From 86f50fb53a29700b873d57c7ecc7a4e4ef5f9fab Mon Sep 17 00:00:00 2001 From: Harrissou Sant-anna Date: Sun, 24 Nov 2024 09:52:34 +0100 Subject: [PATCH] Add to_bool expression function refs qgis/QGIS#59488 --- .../expression_help/Conversions.rst | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/user_manual/expressions/expression_help/Conversions.rst b/docs/user_manual/expressions/expression_help/Conversions.rst index 2f3a93fd17b..f54203e8836 100644 --- a/docs/user_manual/expressions/expression_help/Conversions.rst +++ b/docs/user_manual/expressions/expression_help/Conversions.rst @@ -120,6 +120,30 @@ Encodes a binary value into a string, using the Base64 encoding. .. end_to_base64_section +.. _expression_function_Conversions_to_bool: + +to_bool +....... + +Converts a given value to a boolean. The function will return false if the value is NULL, an empty string, an empty list, or 0. + +.. list-table:: + :widths: 15 85 + + * - Syntax + - to_bool(value) + * - Arguments + - * **value** - value to convert to boolean + * - Examples + - * ``to_bool('')`` → false + * ``to_bool('123')`` → true + * ``to_bool(0)`` → false + * ``to_bool(1)`` → true + * ``to_bool(null)`` → false + + +.. end_to_bool_section + .. _expression_function_Conversions_to_date: to_date