April 24, 2024, 01:55:45 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


CSV file reader

Started by Brian, July 21, 2015, 11:55:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Brian

Hi,

I've been messing with this CSV file reader for a few weeks now, and I reckon it's good enough
to share the code
I think some of the code must have been Sapero's, as it is far too good for me to have written!

It allows a CSV, tab delimited or fixed field file to be opened and viewed
Each column header is clickable to allow sorting
Lines are coloured alternately
You can load CSV files that have no header, in which case built-in column header text is used
It is a project, so the exe can be run without having the bitmap and icon files in the same folder
The menus have bitmaps (something I have wanted to do for a while)
It uses Fletchie's control lib. I have included ctl.inc and ctl.lib if you haven't got them - just move
them into the appropriate include and lib folders

The original files were located in: C:\Users\Public\Documents\IWBasic\projects\ListviewSort
so if you can replicate that path, everything should compile OK

If you see anything glaringly bad, or I have missed something, please let me know

All the best,

Brian

Brian


Bill-Bo

Brian,

I went to the site and download the file for the US. The information is scattered in the fields; like a county might be in a state column, a state in the ZIP column, some might be correct, etc. That's for the free list of 500. Imagine the $10 one of 1 million? The one for the UK seems okay. Can't email them.

Bill

Brian

Bill,

I suppose the author couldn't give you real live data, as I am sure he would breaking
loads of UK and US data protection laws

Brian

Bill-Bo

July 23, 2015, 10:21:18 AM #4 Last Edit: July 23, 2015, 10:31:38 AM by Bill-Bo
Brian,

I think you misunderstood. In the US, MO is the postal code for the state of Missouri. What I'm trying to get across is that in the file, it's suppose to me the the 'State' column, but it might be in the 'ZIP' column. The one under it may be TX (for Texas) and it may be in the correct column. Now, I know about UK addresses. I spent seven(7) years, out of my 23 in the US Air Force,
at RAF Chicksands in Bedfordshire. Loved England, especially Cornwall.

But, I think I see what you're getting at. They're just to be used for testing purposes. But, even for testing, it would have better for whoever to have randomized the data within column, not between columns. How you going to test sorting?

Bill

billhsln

I downloaded US/UK/Can and all look ok to me.  I scrolled all the way to the end of the file, but all the fields look ok.

Bill
When all else fails, get a bigger hammer.

Bill-Bo

Brian & Bill,

I'll stand corrected. I open the US file in my Excel 2007 and everything was in the proper column. I have used Total Commander (a super file manager, plus, to many things to count) for years. It has a feature, Lister, which allows you to view different types of files. One of them is CSV. Well, these are the first CSV files that I've not been able to display correctly. I just don't know.

Bill

Brian

Ah, I think I get what you were saying. You thought he was randomising data over all the columns,
and not just within a certain column? I'll check the UK data I downloaded

Few minutes later . . .

UK data looks OK to me in my ListviewSort program. Postcodes and such are all in the right
places. Only thing I see is hyphens in between area codes and phone numbers, which we don't
normally do here; usually we have a space

It is just nice to have a decent size file to load up for testing

Brian