Hi Forum , we are a bit surprised to find nothing about this weird behaviour in the KBase as the TRIM() RIGHT-TRIM() and LEFT-TRIM() are rather old 4GL Functions
MESSAGE TRIM(' AND ARTICLE.fieldA = "abc" AND ARTICLE.fieldB = "123"', " AND") VIEW-AS ALERT-BOX.
/* Notice 'ARTICLE' gets truncated to 'RTICLE'
---------------------------
Message (Press HELP to view stack trace)
---------------------------
RTICLE.fieldA = "abc" AND ARTICLE.fieldB = "123"
---------------------------
OK Aide
--------------------------- */
The impact is bad for building typical dynamic queries with " AND bladibla " expressions conditionally added to some cqueryString. At a point one needs to change "WHERE AND" into "WHERE ". The TRIM technique is nasty because it only affects tables with name beginning 'A' (or 'O' with OR)
We already have a work-around** but I thought others might want to know about this nasty one.
**The best is to use the SUBSTRING() Statement to remove a targeted ' AND'
Thank you Mike. Indeed, the doc says "trim-chars" and not "trim-string". Actually, I was not using this technique myself... I'll my my peers ;)