Page 1 of 1
Difficulty in building a database?
Posted: Wed Feb 29, 2012 5:34 am
by peter.s
Hi all,
I am thinking of building a friendly user interface which manages a basic database of names and addresses. The user interface would have the capability to add data, edit data, search for names and group selected names. Ideally it should also be able to print a selected group and run on a Windows platform.
I have had some success in building fairly straightforward (presentation style) programs, but have never tackled anything involving databases. So, before I launch into this I have a couple of questions I hope someone may answer.
1. Is it possible to have my interface populated by data in an Excel file - and conversely, have the data saved as an Excel file?
2. On a scale of 1 to 5 (1 being easy and 5 being difficult), how difficult would it be for a database novice like myself to make this kind of program?
I have done a forum search for the word "Excel" but didn't find anything which conclusively answers my firs question.
Many thanks in advance - Peter
Re: Difficulty in building a database?
Posted: Wed Feb 29, 2012 5:58 am
by dunbarx
1- Posting to and reading from an excel file is so easy it will make you laugh.
2- On a scale of 1 to 5, how much expeierince do you have with scripting in LiveCode?
Craig Newman
Re: Difficulty in building a database?
Posted: Wed Feb 29, 2012 6:59 am
by peter.s
Hi Craig,
Thanks for your quick response.
I have some experience with scripting in LiveCode, but it has been fairly basic stuff - mainly assigning tasks to buttons; to open files, video, slideshows and the like. Not much with having a user input data and saving it...
Can you point me to a tutorial which looks at populating a table from an Excel file?
Cheers - Peter
Re: Difficulty in building a database?
Posted: Wed Feb 29, 2012 11:49 am
by Klaus
Hi Peter,
to avoid misunderstandings, I am sure that Craig does NOT mean to write and read
to/from any XLS file, but rather deal with the CSV (text-)format, right?
EXCEL can open CSV (text-)files.
Best
Klaus
Re: Difficulty in building a database?
Posted: Wed Feb 29, 2012 1:57 pm
by bn
Hi,
Excel can also export and read tab delimited files. Those are a lot easier to handle.
There have been numerous discussions about the potential pittfalls of CSV (comma separated values).
Those discussions uniformly recomend the tab delimited format.
If you have a tab delimited text file exported from excel you would set the itemDelimiter to tab and then access the data as in
item x of line y
etc
Kind regards
Bernd
Re: Difficulty in building a database?
Posted: Wed Feb 29, 2012 2:59 pm
by dunbarx
You see how quickly people come to help.
So if you can deal with your data in a tab and return delimited way, you can read and write to excel files, processing your data in LC. Can you write a short script that creates such delimited data? Check out the following in the dictionary: "read from file", "write to file", "close file", "open file".
Write back if you get stuck, but try it. Only experimentation will help you work this out.
Craig Newman
Re: Difficulty in building a database?
Posted: Wed Feb 29, 2012 3:20 pm
by FourthWorld
bn wrote:Excel can also export and read tab delimited files. Those are a lot easier to handle.
There have been numerous discussions about the potential pittfalls of CSV (comma separated values).
Those discussions uniformly recomend the tab delimited format.
Some months ago I took the time to catalog the failures of CSV in this article:
http://www.fourthworld.com/embassy/arti ... t-die.html
For tab-delimited, I've found the FileMaker escaping convention useful and simple, allowing the chunk expressions you provided to work well even with data that may contain tabs and returns, using these functions:
Code: Select all
function EscapeData s
replace tab with numToChar(4) in s
replace cr with numToChar(11) in s
return s
end EscapeData
function UnescapeData s
replace numToChar(4) with tab in s
replace numToChar(11) with tab in s
return s
end UnescapeData
Re: Difficulty in building a database?
Posted: Wed Feb 29, 2012 11:56 pm
by peter.s
Thanks everyone for your useful input. I will give it a try.
I am not a programmer and use LiveCode on the odd occasion. You good people have helped me out many a time and it is comforting to know that you guys are still here
Peter
Re: Difficulty in building a database?
Posted: Thu Mar 01, 2012 12:49 am
by FourthWorld
One of the great things about programming is that everyone starts out as not a programmer. And then you get hooked.

Re: Difficulty in building a database?
Posted: Thu Mar 01, 2012 1:12 pm
by Klaus
In my opinion programming is about logics, not snytax, that's why I'm good at LiveCode!
I can tell the machine what to do as if I was talking to my dumb cousin (if I had one)
