Without the ability to leverage regular expressions in a SQL query within Progress... does anyone know how I can write a where clause that will identify non-alphanumeric values?
I'm not sure a where clause will do what you want. You can certainly code around non alphanumerics. Maybe if you explain a little more what you are trying to achieve a solution could be found.
def var calpha as char no-undo initial "0123456789abcdefghijklmnopqrstuvwxyz".
for each customer where trim( customer.code, calpha ) > "" no-lock:
display customer.code.
end.
Just be aware that no indexes will be used and this will read every record in the table or every record that satisfies any other (valid) where expressions.
Any function (including a non-existent regexp) on the left side of a where clause will result in a table-scan.
And as to how trim works, you need to update your understanding:
trim-chars
A character expression that specifies the characters to trim from expression. If you do not specify trim-chars, the TRIM function removes spaces, tabs, line feeds, and carriage returns.
We use it for the opposite, to enforce numeric entry in a character field (note the extra replace to prevent a space inside the 'numeric' entry from passing the trim):
Code:
IF TRIM( REPLACE( TRIM( i_cacc_nr ), " ":U, "#":U),"0123456789":U ) > "" THEN
Because you have characters in your string that do not match calpha. TRIM works from the left and right of the string and will stop as soon as a character is found that does not match what should be trimmed.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.