Difficulty in building a database?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
peter.s
Posts: 99
Joined: Thu Jul 10, 2008 11:47 am

Difficulty in building a database?

Post by peter.s » Wed Feb 29, 2012 5:34 am

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Difficulty in building a database?

Post by dunbarx » Wed Feb 29, 2012 5:58 am

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

peter.s
Posts: 99
Joined: Thu Jul 10, 2008 11:47 am

Re: Difficulty in building a database?

Post by peter.s » Wed Feb 29, 2012 6:59 am

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

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Difficulty in building a database?

Post by Klaus » Wed Feb 29, 2012 11:49 am

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Difficulty in building a database?

Post by bn » Wed Feb 29, 2012 1:57 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Difficulty in building a database?

Post by dunbarx » Wed Feb 29, 2012 2:59 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Difficulty in building a database?

Post by FourthWorld » Wed Feb 29, 2012 3:20 pm

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
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

peter.s
Posts: 99
Joined: Thu Jul 10, 2008 11:47 am

Re: Difficulty in building a database?

Post by peter.s » Wed Feb 29, 2012 11:56 pm

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 :D

Peter

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Difficulty in building a database?

Post by FourthWorld » Thu Mar 01, 2012 12:49 am

One of the great things about programming is that everyone starts out as not a programmer. And then you get hooked. :)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Difficulty in building a database?

Post by Klaus » Thu Mar 01, 2012 1:12 pm

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) :-)

Post Reply