A situation has come up where a client wishes to extract out on a regular basis a series of CSV flat files of UniVerse data.

Using the SB+ Report Writer I can use the Output Device of ‘D’ (DIFF). This will write out the data in a comma delimited format.

I added the fields along one line, the first line a ‘C’ for columns and the second line a ‘D’ for data. I also overrode the length of each field to 10, as the length is ignored when the extraction occurs.

It is also possible to use additional conversion codes e.g. MCL.

The only issues is how to handle multivalue fields. For text where formatting is not that important, I do a TRANS on the field so the multivalues are combined together. More important multivalves, like transactions in an association, I create a new report and export then out as a separate file.

To make is easy to access the resultant CSV files, I created a new file of type 19 (dictionary) and updated the report details on the Additional Report Parameters screen.

Using this method, it is easy to maintain, even using the user prompting ‘?’ in the selection criteria.

Things to watch for are spaces between the headings in the column line else they will merge into one field. Also, as SB+ just concatenates each field onto the previous, separating them by a comma, the last field will have a trailing comma; hence the whole line/record will end with a comma. It is not really standard, but MS-EXCEL will load the resultant file OK.

Otherwise, it is fast and tidy. It will even compile if needed.