Re: Attention Report Generator and Data Express UseCSV files as alternative to


[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]

Posted by Jon Sacks on May 29, 2007 at 06:26:32:

In Reply to: Re: Attention Report Generator and Data Express UseCSV files as alternative to posted by Jim Guerber on May 28, 2007 at 19:19:05:

Start with your csv convention (i.e. PRINTER [datafile],[dir],H) for the CSV. Since the column headings are in the file all you need is the simple engine to parse the input data from the CSV (XML would work as well as a format). This would be a powerful tool for multiple reasons:

1. The reporter can be used on data external to Comet that is delivered in CSV format.
2. The reporter can create work files in CSV that can then be easily reported on again without building a .D00 or #FILES definition.
3. Data can be combined from an external source with the Comet database via this method. In other words another application creates the CSV then by linking from the CSV to the .D00 based file, information from the database can be appended to the data for reporting.

In fact what would be helpful was new verbs in MTB called OPENCSV/READCSV that parses the data in a read for you into a name/value pair array. I would envision that on an OPENCSV MTB would read the first record and create an array of the field names, the READCSV would then place the data into an array refereance by LUN, CSVFields49$(x) CSVData49$(x).

Example:

"CUSTOMER.NUMBER","CUSTOMER.NAME","CUSTOMER.CITY","CUSTOMER.STATE"
"12345","Jons Candy Store","Anywhere","US"
"12354","Bobs Gift Store","Anytown","AK"

OPENCSV (49) "custlist.csv"
{Result of Open
CSVFIELD49(1)$ = "CUSTOMER.NUMBER"
CSVFIELD49(2)$ = "CUSTOMER.NAME"
CSVFIELD49(3)$ = "CUSTOMER.CITY"
CSVFIELD49(4)$ = "CUSTOMER.STATE"
}
READCSV (49)
{Result of Read
CSVDATA49(1)$ = "12345"
CSVDATA49(2)$ = "Jons Candy Store"
CSVDATA49(3)$ = "Anywhere"
CSVDATA49(4)$ = "US"
}

Another option perhaps is to let the developer specify the array name in the OPENCSV and READCSV
OPENCSV (49,[Array Name]) "custlist.csv"
READCSV (49,[Array Name])

JSACKS<<




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

What is the name of the main Signature System's Product?

Comments:

Optional Link URL:
Link Title:
Optional Image URL:

You may attach up to 5 files to your followup (see below):






[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]