There are two ways that you can use to achieve your needs. One is to use directly the table buffer and the other is to use an QUERY
handle.
First example using a buffer directly from a table (or a TEMP-TABLE, doesn't matter):
DEF VAR dateVar AS DATE NO-UNDO.
FIND FIRST job NO-LOCK.
dateVar = DATE(BUFFER job:BUFFER-FIELD('dt-job'):BUFFER-VALUE).
MESSAGE dateVar
VIEW-AS ALERT-BOX INFO BUTTONS OK.
Second example using a query handle:
DEF VAR dateVar AS DATE NO-UNDO.
DEF QUERY qrJob FOR job.
OPEN QUERY qrJob FOR EACH job.
QUERY qrJob:GET-FIRST().
dateVar = DATE(QUERY qrJob:GET-BUFFER-HANDLE(1):BUFFER-FIELD('dt-job'):BUFFER-VALUE).
MESSAGE dateVar
VIEW-AS ALERT-BOX INFO BUTTONS OK.
As Tim Kuehn said you can substitute 'dt-job'
by # of field in the query if you know its position inside the query. I could used BUFFER-FIELD(2)
in substitution of BUFFER-FIELD('dt-job')
because dt-job
is the #2 field in my query. Keep in mind that use the FIELDS
clause in a FOR EACH
or in an OPEN QUERY
statement changes the order of fields in query. Generally, for browsers only available the columns fields specified in FIELDS
section, in order.
These might work for you. It's important to say that BUFFER-VALUE
always returns a CHARACTER
data type and because of this you need to use DATE
statement for data conversion.
Hope it helps.