Examples of simple databases in LiveCode without SQL??
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Examples of simple databases in LiveCode without SQL??
I used Hypercard many years ago to develop several stacks but don't have a computer any more that I can access them on. I am interested in LiveCode and using the trial version and trying to put together a simple database similar to what I used to be able to do in Hypercard. These databases were usually pretty simple without a lot of records- usually less than a couple of hundred records. I never had to use anything like SQL, but it seems like all of the discussions I have read hin this forum are about using LiveCode as a front end to SQL. Maybe I just haven't read far enough but my eyeballs are getting tired so I thought I would just post this question and see if I get a resonse. I am wondering if there are any examples of simple databases that just use each card as a record and allows the user to add a new card by adding a button? (Actually, I have gotten that far on my own with LiveCard and have a stack of contacts) BUT then, (and I guess this is the hard part) I want a card that lists the names of the contacts alphebetically and when I click on a name, it takes me to their card. I don't want the added complication of using SQL or any other databases or software. I would like to be able to do the entire thing in LiveCode. Are there any samples of simple database stacks in LiveCode like I have described? Thanks!
Re: Examples of simple databases in LiveCode without SQL??
Well, I am sure the list field part will be easy enough (drag it from the Tools palette) 
Getting the list of names would depend on how you are storing the contacts in the stack.. If you are naming the cards with the person's name then you can use the cardNames property to get the list of names and then use the sort command to put them alphabetical..
otherwise you will need to get the text from the field(s) on each card

Getting the list of names would depend on how you are storing the contacts in the stack.. If you are naming the cards with the person's name then you can use the cardNames property to get the list of names and then use the sort command to put them alphabetical..
Code: Select all
--- using the card name property to store the contact name
local tCardNames
put the cardNames of this stack into tCardNames
sort lines of tCardNames -- default sort is text sort
set the text of field "contactNameList" to tCardNames
Code: Select all
--- getting the contact names from text field on each card
local tCardIDs
put the cardIDs of this stack into tCardIDs
local tContactNames
repeat for each line tCardID in tCardIDs
try
put the text of field "contactName" of card tCardID & LF after tContactNames
catch tErr
-- we use a try structure to trap errors where the field does not exist on a particular card
next repeat
end try
end repeat
--- remove the trailing LF
if (char -1 of tContactNames = LF) then
delete char -1 of tContactNames
end if
sort lines of tContactNames
set the text of field "contactNameList" to tContactNames
Re: Examples of simple databases in LiveCode without SQL??
Hi sylvanr,
Have a look at this http://qurl.tk/l0 simple database example on RevOnline.
Kind regards,
Mark
Have a look at this http://qurl.tk/l0 simple database example on RevOnline.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode