Sanity Check
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Sanity Check
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.
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.
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Sanity Check
What are the sizes of the two input files?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Sanity Check
Not large, maybe a few k, but probably 20+ columns each.
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Sanity Check
Do you need a relational database in this conversion process?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Sanity Check
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.
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.
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Sanity Check
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
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Sanity Check
Thanks, I'll pick this back up on Friday - can't wait to dig in. Goodnight and enjoy your Thanksgiving.
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Sanity Check
Thank you, and you too.
When you return from holiday you're about to embark on a great adventure....
When you return from holiday you're about to embark on a great adventure....
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Re: Sanity Check
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:
I love the simplicity of Livecode!
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!
Re: Sanity Check
You don't need SQL, just text manipulation of livecode.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.
See repeat, itemdel, TAB.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Sanity Check
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
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