Hello,
Can anyone tell me why the NUM-RESULTS property from the following code is being returned as zero?
DEF VAR hQry AS HANDLE NO-UNDO.
DEF VAR hBuf AS HANDLE NO-UNDO.
CREATE QUERY hQry.
CREATE BUFFER hBuf FOR TABLE "customer".
hQry:ADD-BUFFER(hBuf).
hQry:QUERY-PREPARE("FOR EACH customer NO-LOCK").
hQry:QUERY-OPEN.
MESSAGE hQry:NUM-RESULTS VIEW-AS ALERT-BOX.
hQry:QUERY-CLOSE.
I can use the QUERY-NEXT method to count the number of records in the table, but I thought using the NUM-RESULTS property would be more efficient?!
Thanks in advance.
You are not using the PRESELECT option so the entire results list is not built immediately. Without PRESELECT, NUM-RESULTS might not return the number of rows in the browse.
HIH
Salvador
Thanks Svi - much apprecaited.
The following change to the code worked a treat...
DEF VAR hQry AS HANDLE NO-UNDO.
DEF VAR hBuf AS HANDLE NO-UNDO.
CREATE QUERY hQry.
CREATE BUFFER hBuf FOR TABLE "customer".
hQry:ADD-BUFFER(hBuf).
hQry:QUERY-PREPARE("PRESELECT EACH customer").
hQry:QUERY-OPEN.
MESSAGE hQry:NUM-RESULTS VIEW-AS ALERT-BOX.
hQry:QUERY-CLOSE.