Exporting to csv

Thanks, it really WAS fun.

After I failed to be able to use the selected TableName as a
variable, I almost gave up. Then I realized I could place the actual
name in a text file, then run it.

This must be what Vantage does with its export. Yesterday I
remembered people saying they found remnants of export code after
cancelling the Vantage export.

Good luck

--- In vantage@y..., "Mark Dupuis" <dupuism@r...> wrote:
> Hello Lonnie,
> You knew where I was heading with all my questions and you
basically
> created the program I was working on. This little jewel you've
created
> answers a lot of my questions. I really like the external table2.p
file.
> Very clever! I never would of thought to simply create another .p
file from
> within my program. If I did I would not of known how to do it.
You have
> furthered my education and opened up a hole new realm of
possibilities,
> THANK YOU :)
> Mark
>
>
> -----Original Message-----
> From: lonniedrew [mailto:lonniedrew@c...]
> Sent: Saturday, August 10, 2002 11:36 AM
> To: vantage@y...
> Subject: [Vantage] Re: exporting to csv
>
>
> I hate it when you guys pose an interesting programming problem.
>
> I had to see if I could do it; so far it cost me 4+ hours of study
> and design. But it was fun.
>
> The source code I just uploaded lets the user select a table, then
> select fields for export. Run from an icon.
>
>
> --- In vantage@y..., William Colls <william@p...> wrote:
> > Mea Culpa.
> >
> > try the following, and see notes below.
> >
> > > define variable done-first as logical.
> > > output to mytest.txt.
> > > find _file no-lock
> > > where _file._file-name EQ "part".
> > > for each _field no-lock of _file by _order:
> > > if not done-first
> > > then done-first = true.
> > > else put ",".
> > > if _field._label EQ ?
> > > then put unformatted '"' _field._field-name '"'.
> > > else put unformatted '"' _field._label '"'.
> > > end.
> > > put skip.
> > >
> > > /* now put the data records into the file */
> > >
> > > For each part:
> > > export delimiter ',' part.
> > > end.
> > > output close.
> > >
> > Mark Dupuis wrote:
> >
> > <snip>
> >
> > >
> > > This is what I think I know?
> > > 1) _file is a table of all the database table names i.e.
> customer, jobmtl,
> > > part, etc.
> >
> > Correct.
> >
> > >
> > > 2) _file-name is the field which has the table names
> >
> > Correct
> >
> > >
> > > 3) this goes through the fields in _file
> > > 4-9) put a delimiter before each field except the first.
> >
> > Correct. Also don't put a comma after the last field.
> >
> > >
> > > 10) part is the name of a buffer which holds one record from
the
> part
> > > table?
> >
> > correct.
> >
> > >
> > > 11) output the record using "," as the delimiter.
> >
> > Correct. You can substitute any character as the delimiter.
> >
> > >
> > > Problem A: The csv file created has column headings and data but
> they do not
> > > match. For example the first column is labeled "Avg. Burden"
but
> the data
> > > is company name.
> >
> > My error, and I should know better. We need to sort the fields
> using the _order field, so they are in the same sequence as the
dump.
> >
> > >
> > >
> > > Problem B: I also have tried to replace the table name "Part"
> with a
> > > variable, something like tablein, this creates real problems
with
> lines
> > > 10-12. How to I reference the buffer using a variable value?
> >
> > Before dynamic queries in version 9, you can't. There are
> techniques to get around this limitation, and if you need to do this
> let me know, and I will post the procedures.
> > Not difficult, but require a little bit of "fiddling".
> >
> > >
> > >
> > > Am I making any sense? I would be grateful for any help I can
> get.
> > > TIA
> >
> > Eminent good sense, and I apologize for making life more difficult
> than necessary.
> >
> > >
> > > Mark
> > >
> > >
> > > Useful links for the Yahoo!Groups Vantage Board are: ( Note:
You
> must have already linked your email address to a yahoo id to enable
> access. )
> > > (1) To access the Files Section of our Yahoo!Group for Report
> Builder and Crystal Reports and other 'goodies', please goto:
> http://groups.yahoo.com/group/vantage/files/.
> > > (2) To search through old msg's goto:
> http://groups.yahoo.com/group/vantage/messages
> > > (3) To view links to Vendors that provide Vantage services goto:
> http://groups.yahoo.com/group/vantage/links
> > >
> > > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> >
> > --
> > /*
> ================================================================= */
> >
> > Sailors, with their inbuilt sense of order and good discipline,
> should
> > really be running the world.
> >
> > William E. Colls Tel 613 591
> 0079
> > PROComputer Systems Fax 613 591
> 3924
> > 67 Willow Glen Drive
> www.procomsys.com
> > Kanata Ontario Canada K2M 1T1 PEG
> 1988051404
>
>
>
> Useful links for the Yahoo!Groups Vantage Board are: ( Note: You
must have
> already linked your email address to a yahoo id to enable access. )
> (1) To access the Files Section of our Yahoo!Group for Report
Builder and
> Crystal Reports and other 'goodies', please goto:
> http://groups.yahoo.com/group/vantage/files/.
> (2) To search through old msg's goto:
> http://groups.yahoo.com/group/vantage/messages
> (3) To view links to Vendors that provide Vantage services goto:
> http://groups.yahoo.com/group/vantage/links
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
Hello group, I copied a piece of code from the group earlier this week and
its driving me nuts %) I have it sort of working but I do not fully
understand what its doing.
Here is the code:

define variable done-first as logical.

1 find _file no-lock
2 where _file._file-name EQ "part".
3 for each _field no-lock of _file:
4 if not done-first
5 then done-first = true.
6 else put ",".
7 put '"' _field._label '"'.
8 end.
9 put skip.

/* now put the data records into the file */

10 For each part:
11 export delimiter ',' part.
12 end.


This is what I think I know?
1) _file is a table of all the database table names i.e. customer, jobmtl,
part, etc.
2) _file-name is the field which has the table names
3) this goes through the fields in _file
4-9) put a delimiter before each field except the first.
10) part is the name of a buffer which holds one record from the part
table?
11) output the record using "," as the delimiter.


Problem A: The csv file created has column headings and data but they do not
match. For example the first column is labeled "Avg. Burden" but the data
is company name.


Problem B: I also have tried to replace the table name "Part" with a
variable, something like tablein, this creates real problems with lines
10-12. How to I reference the buffer using a variable value?

Am I making any sense? I would be grateful for any help I can get.
TIA
Mark
Whats happening is its showing the field names in alphabetical order, while
its exporting the table records in the order in which they are stored in the
DB.

Could someone more familiar with the metaschema enlighten us on this matter?

Time to hit the development manuals...

Thaddeus Jacobs, MCP
Information Solutions Developer
Kinematic Automation, Inc.
mailto:tjacobs@...

-----Original Message-----
From: Mark Dupuis [mailto:dupuism@...]
Sent: Friday, August 09, 2002 9:06 AM
To: Vantage Users Group
Subject: [Vantage] exporting to csv


Hello group, I copied a piece of code from the group earlier this week and
its driving me nuts %) I have it sort of working but I do not fully
understand what its doing.
Here is the code:

define variable done-first as logical.

1 find _file no-lock
2 where _file._file-name EQ "part".
3 for each _field no-lock of _file:
4 if not done-first
5 then done-first = true.
6 else put ",".
7 put '"' _field._label '"'.
8 end.
9 put skip.

/* now put the data records into the file */

10 For each part:
11 export delimiter ',' part.
12 end.


This is what I think I know?
1) _file is a table of all the database table names i.e. customer, jobmtl,
part, etc.
2) _file-name is the field which has the table names
3) this goes through the fields in _file
4-9) put a delimiter before each field except the first.
10) part is the name of a buffer which holds one record from the part
table?
11) output the record using "," as the delimiter.


Problem A: The csv file created has column headings and data but they do not
match. For example the first column is labeled "Avg. Burden" but the data
is company name.


Problem B: I also have tried to replace the table name "Part" with a
variable, something like tablein, this creates real problems with lines
10-12. How to I reference the buffer using a variable value?

Am I making any sense? I would be grateful for any help I can get.
TIA
Mark




Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Mark,

If you are running vantage 5 or later (progress 9.1A or later), you have the
option of using dynamic queries.
http://www.v9stuff.com has some stuff regarding dynamic temp tables.

Thaddeus Jacobs, MCP
Information Solutions Developer
Kinematic Automation, Inc.
mailto:tjacobs@...


-----Original Message-----
From: Thad Jacobs [mailto:tjacobs@...]
Sent: Friday, August 09, 2002 9:23 AM
To: 'vantage@yahoogroups.com'
Subject: RE: [Vantage] exporting to csv


Whats happening is its showing the field names in alphabetical order, while
its exporting the table records in the order in which they are stored in the
DB.

Could someone more familiar with the metaschema enlighten us on this matter?

Time to hit the development manuals...

Thaddeus Jacobs, MCP
Information Solutions Developer
Kinematic Automation, Inc.
mailto:tjacobs@...

-----Original Message-----
From: Mark Dupuis [mailto:dupuism@...]
Sent: Friday, August 09, 2002 9:06 AM
To: Vantage Users Group
Subject: [Vantage] exporting to csv


Hello group, I copied a piece of code from the group earlier this week and
its driving me nuts %) I have it sort of working but I do not fully
understand what its doing.
Here is the code:

define variable done-first as logical.

1 find _file no-lock
2 where _file._file-name EQ "part".
3 for each _field no-lock of _file:
4 if not done-first
5 then done-first = true.
6 else put ",".
7 put '"' _field._label '"'.
8 end.
9 put skip.

/* now put the data records into the file */

10 For each part:
11 export delimiter ',' part.
12 end.


This is what I think I know?
1) _file is a table of all the database table names i.e. customer, jobmtl,
part, etc.
2) _file-name is the field which has the table names
3) this goes through the fields in _file
4-9) put a delimiter before each field except the first.
10) part is the name of a buffer which holds one record from the part
table?
11) output the record using "," as the delimiter.


Problem A: The csv file created has column headings and data but they do not
match. For example the first column is labeled "Avg. Burden" but the data
is company name.


Problem B: I also have tried to replace the table name "Part" with a
variable, something like tablein, this creates real problems with lines
10-12. How to I reference the buffer using a variable value?

Am I making any sense? I would be grateful for any help I can get.
TIA
Mark




Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Thad,
Thanks for the shortcut, It only raises more questions though. Hopefully
someone out there can teach me a few things.
Mark

-----Original Message-----
From: Thad Jacobs [mailto:tjacobs@...]
Sent: Friday, August 09, 2002 12:28 PM
To: 'vantage@yahoogroups.com'
Subject: RE: [Vantage] exporting to csv


Mark,

If you are running vantage 5 or later (progress 9.1A or later), you have the
option of using dynamic queries.
http://www.v9stuff.com has some stuff regarding dynamic temp tables.

Thaddeus Jacobs, MCP
Information Solutions Developer
Kinematic Automation, Inc.
mailto:tjacobs@...


-----Original Message-----
From: Thad Jacobs [mailto:tjacobs@...]
Sent: Friday, August 09, 2002 9:23 AM
To: 'vantage@yahoogroups.com'
Subject: RE: [Vantage] exporting to csv


Whats happening is its showing the field names in alphabetical order, while
its exporting the table records in the order in which they are stored in the
DB.

Could someone more familiar with the metaschema enlighten us on this matter?

Time to hit the development manuals...

Thaddeus Jacobs, MCP
Information Solutions Developer
Kinematic Automation, Inc.
mailto:tjacobs@...

-----Original Message-----
From: Mark Dupuis [mailto:dupuism@...]
Sent: Friday, August 09, 2002 9:06 AM
To: Vantage Users Group
Subject: [Vantage] exporting to csv


Hello group, I copied a piece of code from the group earlier this week and
its driving me nuts %) I have it sort of working but I do not fully
understand what its doing.
Here is the code:

define variable done-first as logical.

1 find _file no-lock
2 where _file._file-name EQ "part".
3 for each _field no-lock of _file:
4 if not done-first
5 then done-first = true.
6 else put ",".
7 put '"' _field._label '"'.
8 end.
9 put skip.

/* now put the data records into the file */

10 For each part:
11 export delimiter ',' part.
12 end.


This is what I think I know?
1) _file is a table of all the database table names i.e. customer, jobmtl,
part, etc.
2) _file-name is the field which has the table names
3) this goes through the fields in _file
4-9) put a delimiter before each field except the first.
10) part is the name of a buffer which holds one record from the part
table?
11) output the record using "," as the delimiter.


Problem A: The csv file created has column headings and data but they do not
match. For example the first column is labeled "Avg. Burden" but the data
is company name.


Problem B: I also have tried to replace the table name "Part" with a
variable, something like tablein, this creates real problems with lines
10-12. How to I reference the buffer using a variable value?

Am I making any sense? I would be grateful for any help I can get.
TIA
Mark




Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
I would recommend reading the programmers handbook to start off, going
through the samples on dynamic queries.

Since we're running 8.3 live, I've only barely touched dynamic stuff in my
test environment, and haven't delved much into automating the creation of an
export for a given table.

Thaddeus Jacobs, MCP
Information Solutions Developer
Kinematic Automation, Inc.
mailto:tjacobs@...

-----Original Message-----
From: Mark Dupuis [mailto:dupuism@...]
Sent: Friday, August 09, 2002 11:32 AM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] exporting to csv


Thad,
Thanks for the shortcut, It only raises more questions though. Hopefully
someone out there can teach me a few things.
Mark

-----Original Message-----
From: Thad Jacobs [mailto:tjacobs@...]
Sent: Friday, August 09, 2002 12:28 PM
To: 'vantage@yahoogroups.com'
Subject: RE: [Vantage] exporting to csv


Mark,

If you are running vantage 5 or later (progress 9.1A or later), you have the
option of using dynamic queries.
http://www.v9stuff.com has some stuff regarding dynamic temp tables.

Thaddeus Jacobs, MCP
Information Solutions Developer
Kinematic Automation, Inc.
mailto:tjacobs@...


-----Original Message-----
From: Thad Jacobs [mailto:tjacobs@...]
Sent: Friday, August 09, 2002 9:23 AM
To: 'vantage@yahoogroups.com'
Subject: RE: [Vantage] exporting to csv


Whats happening is its showing the field names in alphabetical order, while
its exporting the table records in the order in which they are stored in the
DB.

Could someone more familiar with the metaschema enlighten us on this matter?

Time to hit the development manuals...

Thaddeus Jacobs, MCP
Information Solutions Developer
Kinematic Automation, Inc.
mailto:tjacobs@...

-----Original Message-----
From: Mark Dupuis [mailto:dupuism@...]
Sent: Friday, August 09, 2002 9:06 AM
To: Vantage Users Group
Subject: [Vantage] exporting to csv


Hello group, I copied a piece of code from the group earlier this week and
its driving me nuts %) I have it sort of working but I do not fully
understand what its doing.
Here is the code:

define variable done-first as logical.

1 find _file no-lock
2 where _file._file-name EQ "part".
3 for each _field no-lock of _file:
4 if not done-first
5 then done-first = true.
6 else put ",".
7 put '"' _field._label '"'.
8 end.
9 put skip.

/* now put the data records into the file */

10 For each part:
11 export delimiter ',' part.
12 end.


This is what I think I know?
1) _file is a table of all the database table names i.e. customer, jobmtl,
part, etc.
2) _file-name is the field which has the table names
3) this goes through the fields in _file
4-9) put a delimiter before each field except the first.
10) part is the name of a buffer which holds one record from the part
table?
11) output the record using "," as the delimiter.


Problem A: The csv file created has column headings and data but they do not
match. For example the first column is labeled "Avg. Burden" but the data
is company name.


Problem B: I also have tried to replace the table name "Part" with a
variable, something like tablein, this creates real problems with lines
10-12. How to I reference the buffer using a variable value?

Am I making any sense? I would be grateful for any help I can get.
TIA
Mark




Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/




Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Mea Culpa.

try the following, and see notes below.

> define variable done-first as logical.
> output to mytest.txt.
> find _file no-lock
> where _file._file-name EQ "part".
> for each _field no-lock of _file by _order:
> if not done-first
> then done-first = true.
> else put ",".
> if _field._label EQ ?
> then put unformatted '"' _field._field-name '"'.
> else put unformatted '"' _field._label '"'.
> end.
> put skip.
>
> /* now put the data records into the file */
>
> For each part:
> export delimiter ',' part.
> end.
> output close.
>
Mark Dupuis wrote:

<snip>

>
> This is what I think I know?
> 1) _file is a table of all the database table names i.e. customer, jobmtl,
> part, etc.

Correct.

>
> 2) _file-name is the field which has the table names

Correct

>
> 3) this goes through the fields in _file
> 4-9) put a delimiter before each field except the first.

Correct. Also don't put a comma after the last field.

>
> 10) part is the name of a buffer which holds one record from the part
> table?

correct.

>
> 11) output the record using "," as the delimiter.

Correct. You can substitute any character as the delimiter.

>
> Problem A: The csv file created has column headings and data but they do not
> match. For example the first column is labeled "Avg. Burden" but the data
> is company name.

My error, and I should know better. We need to sort the fields using the _order field, so they are in the same sequence as the dump.

>
>
> Problem B: I also have tried to replace the table name "Part" with a
> variable, something like tablein, this creates real problems with lines
> 10-12. How to I reference the buffer using a variable value?

Before dynamic queries in version 9, you can't. There are techniques to get around this limitation, and if you need to do this let me know, and I will post the procedures.
Not difficult, but require a little bit of "fiddling".

>
>
> Am I making any sense? I would be grateful for any help I can get.
> TIA

Eminent good sense, and I apologize for making life more difficult than necessary.

>
> Mark
>
>
> Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
> (1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
> (2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
> (3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/links
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

--
/* ================================================================= */

Sailors, with their inbuilt sense of order and good discipline, should
really be running the world.

William E. Colls Tel 613 591 0079
PROComputer Systems Fax 613 591 3924
67 Willow Glen Drive www.procomsys.com
Kanata Ontario Canada K2M 1T1 PEG 1988051404
I hate it when you guys pose an interesting programming problem.

I had to see if I could do it; so far it cost me 4+ hours of study
and design. But it was fun.

The source code I just uploaded lets the user select a table, then
select fields for export. Run from an icon.


--- In vantage@y..., William Colls <william@p...> wrote:
> Mea Culpa.
>
> try the following, and see notes below.
>
> > define variable done-first as logical.
> > output to mytest.txt.
> > find _file no-lock
> > where _file._file-name EQ "part".
> > for each _field no-lock of _file by _order:
> > if not done-first
> > then done-first = true.
> > else put ",".
> > if _field._label EQ ?
> > then put unformatted '"' _field._field-name '"'.
> > else put unformatted '"' _field._label '"'.
> > end.
> > put skip.
> >
> > /* now put the data records into the file */
> >
> > For each part:
> > export delimiter ',' part.
> > end.
> > output close.
> >
> Mark Dupuis wrote:
>
> <snip>
>
> >
> > This is what I think I know?
> > 1) _file is a table of all the database table names i.e.
customer, jobmtl,
> > part, etc.
>
> Correct.
>
> >
> > 2) _file-name is the field which has the table names
>
> Correct
>
> >
> > 3) this goes through the fields in _file
> > 4-9) put a delimiter before each field except the first.
>
> Correct. Also don't put a comma after the last field.
>
> >
> > 10) part is the name of a buffer which holds one record from the
part
> > table?
>
> correct.
>
> >
> > 11) output the record using "," as the delimiter.
>
> Correct. You can substitute any character as the delimiter.
>
> >
> > Problem A: The csv file created has column headings and data but
they do not
> > match. For example the first column is labeled "Avg. Burden" but
the data
> > is company name.
>
> My error, and I should know better. We need to sort the fields
using the _order field, so they are in the same sequence as the dump.
>
> >
> >
> > Problem B: I also have tried to replace the table name "Part"
with a
> > variable, something like tablein, this creates real problems with
lines
> > 10-12. How to I reference the buffer using a variable value?
>
> Before dynamic queries in version 9, you can't. There are
techniques to get around this limitation, and if you need to do this
let me know, and I will post the procedures.
> Not difficult, but require a little bit of "fiddling".
>
> >
> >
> > Am I making any sense? I would be grateful for any help I can
get.
> > TIA
>
> Eminent good sense, and I apologize for making life more difficult
than necessary.
>
> >
> > Mark
> >
> >
> > Useful links for the Yahoo!Groups Vantage Board are: ( Note: You
must have already linked your email address to a yahoo id to enable
access. )
> > (1) To access the Files Section of our Yahoo!Group for Report
Builder and Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
> > (2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
> > (3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
>
> --
> /*
================================================================= */
>
> Sailors, with their inbuilt sense of order and good discipline,
should
> really be running the world.
>
> William E. Colls Tel 613 591
0079
> PROComputer Systems Fax 613 591
3924
> 67 Willow Glen Drive
www.procomsys.com
> Kanata Ontario Canada K2M 1T1 PEG
1988051404
William,
Thank you for the feedback. It troubles me that the buffer name is the
table name. Before I figured this out I was really confused %) I find the
code difficult to follow when I am not sure if it is making reference to a
table or to a buffer.
Using a variable to represent a buffer is not something I need to do, its
just one of those things that will drive me nuts until I figure it out. I
will look into dynamic queries. Thanks again.
Mark

-----Original Message-----
From: William Colls [mailto:william@...]
Sent: Friday, August 09, 2002 11:06 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] exporting to csv


Mea Culpa.

try the following, and see notes below.

> define variable done-first as logical.
> output to mytest.txt.
> find _file no-lock
> where _file._file-name EQ "part".
> for each _field no-lock of _file by _order:
> if not done-first
> then done-first = true.
> else put ",".
> if _field._label EQ ?
> then put unformatted '"' _field._field-name '"'.
> else put unformatted '"' _field._label '"'.
> end.
> put skip.
>
> /* now put the data records into the file */
>
> For each part:
> export delimiter ',' part.
> end.
> output close.
>
Mark Dupuis wrote:

<snip>

>
> This is what I think I know?
> 1) _file is a table of all the database table names i.e. customer,
jobmtl,
> part, etc.

Correct.

>
> 2) _file-name is the field which has the table names

Correct

>
> 3) this goes through the fields in _file
> 4-9) put a delimiter before each field except the first.

Correct. Also don't put a comma after the last field.

>
> 10) part is the name of a buffer which holds one record from the part
> table?

correct.

>
> 11) output the record using "," as the delimiter.

Correct. You can substitute any character as the delimiter.

>
> Problem A: The csv file created has column headings and data but they do
not
> match. For example the first column is labeled "Avg. Burden" but the data
> is company name.

My error, and I should know better. We need to sort the fields using the
_order field, so they are in the same sequence as the dump.

>
>
> Problem B: I also have tried to replace the table name "Part" with a
> variable, something like tablein, this creates real problems with lines
> 10-12. How to I reference the buffer using a variable value?

Before dynamic queries in version 9, you can't. There are techniques to get
around this limitation, and if you need to do this let me know, and I will
post the procedures.
Not difficult, but require a little bit of "fiddling".

>
>
> Am I making any sense? I would be grateful for any help I can get.
> TIA

Eminent good sense, and I apologize for making life more difficult than
necessary.

>
> Mark
>
>
> Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must
have already linked your email address to a yahoo id to enable access. )
> (1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
> (2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
> (3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

--
/* ================================================================= */

Sailors, with their inbuilt sense of order and good discipline, should
really be running the world.

William E. Colls Tel 613 591 0079
PROComputer Systems Fax 613 591 3924
67 Willow Glen Drive www.procomsys.com
Kanata Ontario Canada K2M 1T1 PEG 1988051404




Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/