TOPIC: Import data files?
#198
Import data files? 4 Years, 3 Months ago
Hi,
I have just discovered Suneido. I have been using Foxpro for application development for a number of years together with a framework. The majority are in house apps and the upgrade cost is becoming ridiculous. Unfortunatly I will have a learning curve as in 25yrs of IT I have never programmed in C or Java. Went through the user manual but have a simple question;

Is there a way to import/export text/comma del files into the database. As my first Suneido app I would like to convert an existing program and import the data.

Garry.
 
 
#200
Re:Import data files? 4 Years, 3 Months ago
Hello,
If you open the table in an Access, click on The Global menu button and use the Import / Export options. From the workspace you can use Import, ImportCSV, ImportTab, ImportXML, Export, ExportCSV, ExportTab and ExportXML commands. You can read more about them from the Users Manual.
ajith
 
 
#201
Re:Import data files? 4 Years, 3 Months ago
Hi Garry,

Probably the easiest way to start importing data is by using AccessControl's Global Import option. You can define your own Access, or you can use the "Access a Query..." option from the IDE menu on the WorkSpace. Once you are in the Access window, the Global menu button is close to the bottom right of the window, choose "Import..." from the Global menu.

You can also use the Import/Export classes directly if you want, all the classes are in stdlib->Tools->ImportExport. If you search for Import in the user's manual you will find some documentation on the Import features of Suneido.
 
 
Jeff Ferguson
Suneido Software
 
#203
Re:Import data files? 4 Years, 3 Months ago
Thanks Guys,

Appreciated. I should do what I preach and look at the manuals better.

Garry
 
 
#937
Re:Import data files? 3 Years, 1 Month ago
Hi.

I have tried to import a CSV file unsuccessfully. I get the following error:

"unknown method: numberSuffix?"

Any hints?
 
 
#1912
Re:Import data files? 3 Months, 4 Weeks ago
Bump! I'm seeing the same thing. Trying to import data in a CSV from Access and get the same error. I have a pretty small DB in Access I'm trying to move over and a simple import like this would be ideal.
 
 
#1913
Re:Import data files? 3 Months, 3 Weeks ago
Strange, I am not sure where the problem is. It is also strange that no one responded to the previous post. I must have missed it somehow.

Looking at Import in stdlib, I see it does .Suffix? on the field name. Do you have field names that are numbers?

Or maybe your file doesn't have a first record with field names and it is taking the first data record as the field names?

Also, do you have Field_ definitions for your fields? Import uses Encode from the Field_ class to convert values to the proper type.
 
 
andrew
 
#1914
Re:Import data files? 3 Months, 3 Weeks ago
OK, my file didn't have field names in the first line, and the first column was a ID column (integer), so that appeared to be the problem. Got the import to run, but on a file that looks like this:

class_id, class_desc
1, "Freight"
2, "Passenger"
3, "Engine"

it imported the values into the table class (columns class_id, class_desc)
like this:

1 ""
2 ""
3 ""

OK, I figured maybe the import dialog's comma delimited parser couldn't do CSV. Tried removing the quotes--no change. Put the quotes back, and used ImportCSV in the WorkSpace like so:

ImportCSV('c:class.txt','class')

and the result was the same once again--imported the numbers just fine, but imported only the quotes into the class_desc column.
 
 
#1915
Re:Import data files? 3 Months, 3 Weeks ago
The problem appears to be with string.SplitCSV (in Strings)

If you remove the spaces after the commas it works.

But, of course, space after comma should be allowed.

I don't know if this worked previously and got broken, or if it has always been like this.

I will work on this more and make sure I add some test cases.

Thanks for reporting this problem!
 
 
andrew
 
#1916
Re:Import data files? 3 Months, 3 Weeks ago
Thanks for responding again! I'll try this again tonight and if I get it to work, I'll load up the rest of my DB and get to building out my app. Can't wait!
 
 
#1917
Re:Import data files? 3 Months, 3 Weeks ago
Maybe not "of course" :-)

en.wikipedia.org/wiki/Comma-separated_values says according to RFC 4180 "Spaces are considered part of a field and should not be ignored."

Do we need an option whether to ignore spaces?
 
 
andrew
 
#1918
Re:Import data files? 3 Months, 3 Weeks ago
Nope, don't think so. The file actually had spaces in only the first line--not the data lines. As soon as I removed the space in the column line, the import worked fine.

I'd stick with the RFC spec.