redwards1966
New Member
Hi all,
After having spent most of my career with MS products, I'm just starting along the Progress road getting my feet wet and I'm having a little trouble.
I have already written a procedure that will read query information from an ini file and export said query to a delimited text file based on command line filters etc. This all works great, but now I want the query to be able to support data from more than one table.
As an example (I'll use the trusty Sports2000 db) I'd like to be able to export all Orders that belong to a customer whose state = 'NH'.
Currently I'm doing something like this which would support a single table. ExportRecord is just my function that returns the string of fields based on the current record.
How could I modify the above code to behave for the Order/Customer sample I mentioned? I'm imagining it has something to do with the create buffer and query-prepare statements, but if I try to change them to add order and the proper query it's giving me errors.
Anyone?
After having spent most of my career with MS products, I'm just starting along the Progress road getting my feet wet and I'm having a little trouble.
I have already written a procedure that will read query information from an ini file and export said query to a delimited text file based on command line filters etc. This all works great, but now I want the query to be able to support data from more than one table.
As an example (I'll use the trusty Sports2000 db) I'd like to be able to export all Orders that belong to a customer whose state = 'NH'.
Currently I'm doing something like this which would support a single table. ExportRecord is just my function that returns the string of fields based on the current record.
Code:
DEF VAR vQuery AS HANDLE NO-UNDO.
DEF VAR vBuffer AS HANDLE NO-UNDO.
DEF STREAM outfile.
OUTPUT STREAM outfile TO "C:\customer.txt".
/* *************************** Main Block *************************** */
CREATE QUERY vQuery.
CREATE BUFFER vBuffer FOR TABLE "Customer".
vQuery:ADD-BUFFER(vBuffer).
vQuery:QUERY-PREPARE("FOR EACH Customer NO-LOCK").
vQuery:QUERY-OPEN().
vQuery:GET-NEXT().
DEF VAR vOutStr AS CHARACTER NO-UNDO.
REPEAT WHILE NOT vQuery:QUERY-OFF-END:
vOutStr = ExportRecord(INPUT vQuery:GET-BUFFER-HANDLE(1), ",") + ",".
PUT STREAM outfile UNFORMATTED vOutStr SKIP.
vQuery:GET-NEXT().
END.
Anyone?