Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Code Download - Dark Data CSV Import

Author
Message
anwserman
15
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 7th Jul 2011 09:49 Edited at: 7th Jul 2011 09:49
Hey everyone,
As my first real contribution to the Dark Basic Pro community, I am releasing the app that I made to batch process CSV files into a form usable by the Dark Data plugin.

I have the code pretty well commented, so I don't think it will take a rocket scientist to figure it out. It has saved me quite a bit of time so far!

Check it out

EDIT: Requires IanM's amazing plugin set to run.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Jul 2011 15:11
Can I suggest you replace your SPLIT STRING call with a SPLIT CSV STRING call?

SPLIT CSV STRING is better designed for splitting CSV files as it deals correctly with the types of files that are generated with spreadsheets.

Xrox
15
Years of Service
User Offline
Joined: 1st Nov 2010
Location:
Posted: 22nd Aug 2011 21:42
Hello anwserman, I been studing your code but can't get it to work. Could you give me an example with a csv file so I could see how you're doing it. I'm really interested in this. Thank you.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 23rd Aug 2011 11:30
A .CSV file is just a .txt file. The first line of the file has as many titles as you want for each column all separated by commas and sometimes around quotes. Usually their created for/by (as IanM said) spreadsheet programs like Open Office Calc.

http://en.wikipedia.org/wiki/Comma-separated_values

Xrox
15
Years of Service
User Offline
Joined: 1st Nov 2010
Location:
Posted: 23rd Aug 2011 20:37
Thanks Grog for helping me. I read the link you give me and it was the quote marks the whole time messing it up. thanks for helping
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Aug 2011 21:07
That's why I suggested the change in command used to split the string up - SPLIT CSV STRING knows all about the double-quoting of fields in a line of CSV data.

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 24th Aug 2011 01:26
Yeah IanM is right.

I've recently been working with .CSVs too and SPLIT CSV STRING is so much easier to use than the regular SPLIT STRING because of the quotes. I used SPLIT STRING first and used UNQUOTE$() to remove the quotes but then noticed SPLIT CSV STRING and there's no need to tell it to separate the string by commas because IanM made sure it knows how to split a CSV already.

Xrox
15
Years of Service
User Offline
Joined: 1st Nov 2010
Location:
Posted: 24th Aug 2011 01:34
Thanks guys for the Info and IanM thanks for your wonderful plugins they are a big help.

Login to post a reply

Server time is: 2026-07-10 17:19:08
Your offset time is: 2026-07-10 17:19:08