Sanity Check

Creating desktop or client-server database solutions?

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
jfwhite
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 20
Joined: Tue May 10, 2011 9:12 am

Sanity Check

Post by jfwhite » Wed Nov 22, 2017 9:56 pm

I have a project that shouldn't be too hard and I will learn a lot, but I want to be sure I have a solid concept. The requirement is to read two text files, then export combinations of that data into three different text files. I think the easiest way would be to import the data into a SQLite database, that would make the extracting much simpler. So I would:

1. Connect to db
2. Create tables
3. Use an answer file dialog to navigate to the text file, and probably put that data into a text field.
4. Somehow get that tab delimited data into the database table.
5. Repeat with file #2.
6. Execute query to manipulate data and place into text fields.
7. Export that data into comma separated files.

So if I'm not missing anything, my biggest question is #4 - how can I get the tab separated text inserted into the table? I'm not finding anything about this specific task online.

If there's a flaw in the general approach feel free to point that out, or otherwise give me any tips or advice that would be helpful. TIA.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6173
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Sanity Check

Post by FourthWorld » Thu Nov 23, 2017 3:42 am

What are the sizes of the two input files?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jfwhite
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 20
Joined: Tue May 10, 2011 9:12 am

Re: Sanity Check

Post by jfwhite » Thu Nov 23, 2017 4:55 am

Not large, maybe a few k, but probably 20+ columns each.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6173
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Sanity Check

Post by FourthWorld » Thu Nov 23, 2017 4:58 am

Do you need a relational database in this conversion process?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jfwhite
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 20
Joined: Tue May 10, 2011 9:12 am

Re: Sanity Check

Post by jfwhite » Thu Nov 23, 2017 5:15 am

No but I am fluent in SQL and thought it would make constructing the export files easy, especially if the specs change in the future.

In doing more reading it seems like getting the tab separated input files into a data grid would then make it easy to get into the db tables. But I'm very open to any approach you suggest.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6173
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Sanity Check

Post by FourthWorld » Thu Nov 23, 2017 5:22 am

Read the files, put their contents into variables, do what you need to do to produce the result, write the result to files. I wouldn't bother adding extra steps like putting the data into a datagrid, a database, or even a field. Those are all useful, but only when you need 'em. With small data sets just work with them in variables and you'll have simple code and fast performance.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jfwhite
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 20
Joined: Tue May 10, 2011 9:12 am

Re: Sanity Check

Post by jfwhite » Thu Nov 23, 2017 5:30 am

Thanks, I'll pick this back up on Friday - can't wait to dig in. Goodnight and enjoy your Thanksgiving.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6173
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Sanity Check

Post by FourthWorld » Thu Nov 23, 2017 8:08 am

Thank you, and you too.

When you return from holiday you're about to embark on a great adventure....
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 278
Joined: Tue Apr 10, 2012 9:18 am

Re: Sanity Check

Post by ghettocottage » Thu Nov 23, 2017 8:05 pm

I have a little application that runs on my server where I write some times/dates onto a text-file, then check it later and update the text. In my mind it was going to be a complicated thing, but once I delved into it, I found it was as simple as:

Code: Select all

	#get the most recent status from the time file
	put line 1 of  URL "file:time" into tLastEvent
	put line 2 of  URL "file:time" into tDate
	put line 3 of  URL "file:time" into tTime

         ...do some stuff, then: 

	#update the time file
	put "down" into line 1 of URL "file:time"
	put the date into line 2 of URL "file:time"
	put the time into line 3 of URL "file:time"

I love the simplicity of Livecode!

MaxV
Posts: 1540
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Sanity Check

Post by MaxV » Fri Dec 15, 2017 12:34 pm

jfwhite wrote:
Wed Nov 22, 2017 9:56 pm

1. Connect to db
2. Create tables
3. Use an answer file dialog to navigate to the text file, and probably put that data into a text field.
4. Somehow get that tab delimited data into the database table.
5. Repeat with file #2.
6. Execute query to manipulate data and place into text fields.
7. Export that data into comma separated files.
You don't need SQL, just text manipulation of livecode.
See repeat, itemdel, TAB.
Livecode Wiki: http://livecode.wikia.com
My blog: http://livecodeitalia.blogspot.it
To post code use this: http://tinyurl.com/ogp6d5w

teriibi
Posts: 254
Joined: Mon Nov 13, 2017 3:49 pm
Location: Bolivia

Re: Sanity Check

Post by teriibi » Fri Jan 12, 2018 3:00 pm

HI...
dont know if it could helps but you can check here about one way to Retreive Online DB Tab delimited data ...down to columns fields of your local Stack.
(just a small part of the complete solution)

viewtopic.php?f=12&t=27521#p162474

Post Reply

Return to “Databases”