-    UD8 REPORTS    

Writing Report files with UD8/CSV

Without a doubt, the most commonly needed feature in Uniface is the ability to read comma separated files. However, CSV files (or tab delimited etc) can also be very useful for storing data in, even for reports.

The UD8/CSV Driver acts like a database to Uniface, though it is actually reading and writing delimited text files (eg: CSV files). This feature in combination with the dynamic table names feature allows you to read and write CSV files with the greatest of simplicity from within UNIFACE.

How you set filenames / tablenames

Uniface developer may communicate with the driver at run-time using the SQL proc instruction. Any 'parameter' specified in in the help file for USYS$UD8_PARAMS may be sent to the driver, or a 'tablename' string may be sent. eg:

sql ":logical_table:obsolete:new_table","$ud8"

The 3 fields are:

This command will have NO EFFECT on tables that are already opened. So it is best to use this command BEFORE the first retrieve or store on the table, or alternatively, close the path first, eg:

close "$ud8"
sql ":person:obsolete:client","$ud8"

How to write a CSV report

In this example we are reading all of the records where balance > 0 from the CSV fiel called customers.csv, and then writing the report to a CSV file called debtors.csv. The file customers.csv has a 1 line heading at the beginning of the file.

The assignment file setting is, eg:


An example

balance.customers= ">0"
retrieve/e "customers"
if ($status != 0) return -1

setocc "customers",-1
release/e/mod "customers"

close "$ud8"
sql ":customers:create:debtors.csv","$ud8"
sql "heading disable","$ud8"



- UD8/CSV driver is available for all Uniface supported platforms

$Revision: 1.8 $ $Date: 2011/02/28 02:56:33 $[go to top]