Hello Chuck,
I'll have a look at it too:)
Hopefully I'll be choosing which direction to go by tomorrow:)

Thanks,

Xavier



Hi Xavier,

On Oct 23, 2006, at 3:30 AM, Dev WO wrote:
Hi,
searching the list I have found many post about excel export and things like that. But I'm actually looking for a way to import CSV into a WO application.

Is there anything already done to handle importing of CSV?

Like providing a NSArray of column name, an editing context and an eo to match the value to?

If you look in GVCFoundation, there is a DelimitedStringTokenizer (ignore the incorrect class comments that someone copied and pasted from FixedWidthStringTokenizer) that can be used to parse out each line of CSV. It handles quotes, embedded commas etc.

In the GVCVirutalTables framework in VirtualTable.java is a method

    public void importTable(InputStream stream,
                            Object sender,
                            NSArray columnsToImport,
                            NSDictionary formatters,
                            String delimiter,
                            boolean skipFirstLine,
                            boolean shouldReplace)

that is close to what you want. It is intended to work with our Virtual Tables, not regular EOs, but would be a good starting point. You will see that we create the objects by getting EOF to create raw SQL Insert statements. If you are importing a lot of data this is needed for speed. EOF is not optimized for bulk inserts.

You can get these frameworks (source and binary) here:
http://sourceforge.net/projects/gvcsitemaker

HTH,

Chuck

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/ practical_webobjects







_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to