output records from sdo

am2000

New Member
Hi I'm new to V9 and using SDO'S.
I am looking at the sports200 database examples on dynamic queries e.t.c.
In the following example tmpqrystring is being passed to a datasource h_customer and the results are passed
back in the query.


{set queryWhere tmpqrystringdisp h_customer}.
{set querySort cSort h_customer}.
{fn openQuery h_customer}

My question is , is there a quick way of outputting the results of the query to a CSV File for example.

Its probarbly quite simple but i'm new to v9 and trying to take it all in , asap.

Kind Regards

Ray
 
Try the following. hDefBuffer is the default buffer handle for the table on which the query is running (hQuery:GET-BUFFER-HANDLE(1)) and hQuery is your query.

hQuery:GET-FIRST.

REPEAT:
ASSIGN cOutput = "".
DO iLoop = 1 TO hDefBuff:NUM-FIELDS:
ASSIGN hField = hDefBuff:BUFFER-FIELD(iLoop).
ASSIGN cOutput = cOutput
+ (IF iLoop EQ 1 THEN "" ELSE ",")
+ TRIM(REPLACE(hField:STRING-VALUE,","," ")).
END.
PUT STREAM so-Report UNFORMATTED cOutput SKIP.
hQuery:GET-NEXT.
IF hQuery:QUERY-OFF-END THEN
LEAVE.
END.
 
Top