Feedback
Did this article resolve your question/issue?

   

Article

How to distinguish the unknown value from the question mark character in ABL comparison expressions

Information

 
TitleHow to distinguish the unknown value from the question mark character in ABL comparison expressions
URL NameP161704
Article Number000130611
EnvironmentProduct: OpenEdge
Version: All supported versions
OS: All supported platforms
Question/Problem Description
How to distinguish the unknown value from the question mark character in 4GL comparison expressions
How to use the unknown value in a comparison expression
How to check for the unknown value in ABL
How to check for null values in ABL
How to compare values to "?" in ABL
How to tell a question mark from the unknown value in a comparison expression
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
Resolution

To refer to the unknown (null) value in a comparison operation, use the character "?" (question mark) without any quotation marks:

IF myVariable = ? THEN DISPLAY "This value is unknown".

To refer to the question mark character rather than the unknown value, enclose it in single or double quotes:

IF myVariable = '?' THEN DISPLAY "This is a question mark".
IF myvariable = "?" THEN DISPLAY "This is a question mark".

The BUFFER-VALUE attribute of the BUFFER-FIELD handle used in constructing dynamic queries interprets "?" as the unknown value whether it is quoted or not.

To construct a dynamic query containing a literal question mark character,  start session with the -literalquestion client startup parameter:
 
DEFINE TEMP-TABLE ttTable
FIELD iCnt AS INTEGER
FIELD cString AS CHARACTER
.

CREATE ttTable.
ASSIGN iCnt = 1
cString = "?"
.

CREATE ttTable.
ASSIGN iCnt = 2
cString = ?
.

FOR EACH ttTable:
DISPLAY iCnt cString ASC(cString).
END.

EMPTY TEMP-TABLE ttTable.

DEFINE VARIABLE hBuffer AS HANDLE NO-UNDO.
hBuffer = BUFFER ttTable:HANDLE.

hBuffer:BUFFER-CREATE() .
ASSIGN hBuffer::iCnt = 1
hBuffer::cString = "?"
.

hBuffer:BUFFER-CREATE() .
ASSIGN hBuffer::iCnt = 2
hBuffer::cString = ?
.

FOR EACH ttTable:
DISPLAY iCnt cString ASC(cString).
END.

Or use the Literal-QUESTION attribute of the BUFFER-FIELD handle to overide this default behaviour.  For further example refer to Article 000029199, Buffer-value assignment does not distinguish ? from "?"  
 
Workaround
Notes
References to Written Documentation:

OpenEdge Development: ABL Reference, "ABL Reference > ? Special character"
https://docs.progress.com/bundle/abl-reference/page/Special-character.html   

Startup Command and Parameter Reference: Startup Parameter Descriptions, "Literal Question (-literalquestion)"
https://docs.progress.com/bundle/openedge-startup-reference/page/Literal-Question-literalquestion.html   

Progress Article:

000072924, Assigning .NET property to ? does not yield expected result  
Last Modified Date2/11/2020 9:17 AM
Attachment 
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.