Skip to content
Snippets Groups Projects
Commit 36d4e0cd authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'F17192_qifprepend' into 'develop'

F17192: Implemented new sql function QIFPREPEND. Added documentation refs #17192

See merge request !629
parents 1b6f8aff 42e13901
No related branches found
No related tags found
4 merge requests!691New version v24.3.0,!638Merge Develop to B16343,!637develop into F17086-Multiple-Forms-on-a-page,!629F17192: Implemented new sql function QIFPREPEND. Added documentation refs #17192
Pipeline #11053 passed
......@@ -2168,6 +2168,21 @@ Output::
12-345-678
.. _qifprepend:
QIFPREPEND: if not empty show input with prepend separator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The SQL function QIFPREPEND(separator, input) returns 'input' with prepend separator if 'input' is not 'empty string' / '0'.
Example::
10.sql = SELECT 'lastName', QIFPREPEND(', ','title'), QIFPREPEND(', ','')
Output::
lastName, title
.. _strip_tags:
strip_tags: strip html tags
......
......@@ -401,3 +401,21 @@ BEGIN
RETURN @highlighted_text;
END;
###
#
# QIFPREPEND(separator, input)
# If 'input' is not empty|0, prepend separator to given input
#
DROP FUNCTION IF EXISTS QIFPREPEND;
CREATE FUNCTION QIFPREPEND(`separator` VARCHAR(128), `input` TEXT)
RETURNS TEXT
DETERMINISTIC
SQL SECURITY INVOKER
BEGIN
DECLARE output TEXT;
SET output =
IF(ISNULL(`input`) OR `input` = '' OR `input` = '0',
'',
CONCAT(`separator`, `input`));
RETURN output;
END;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment