On 7/17/2014 11:13 AM, Richard Reeve wrote:
I need to build an extract file from the I that will end up being a
pipe delimited text file. My issues are as follows;

1. There are multiple record types (with unique formats per
record type).

2. The delimited file needs to be ordered by employee and record
type

I am struggling to come up with an efficient way of doing this. Any
thoughts or suggestions would be much appreciated.

The classic one-off is to use SQL:
select empno concat '|' concat trim(empname) concat '|'...
from employees
order by empno...

Depending on what delimited means to your trading partner, you may need
to additionally wrap character fields in double quotes:
select empno concat '|"' concat trim(empname) concat '"|'...

This looks a lot like a CSV file with pipes instead of commas. Giuseppe
Costagliola wrote a utility to convert an SQL statement into a CSV file
10 years ago:
http://www.mcpressonline.com/tips-techniques/sql/techtip-sql2csv-and-sql2xml.html
You might use his code as a starting point.

I'd be leery of trying to tweak a CSV file after the fact - say, convert
comma to pipe with grep/sed or tr - because the data may have legitimate
commas that you don't want to translate.
--buck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.