Strategy to construct a Stack

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

tlottrike
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 11
Joined: Mon Oct 31, 2011 3:46 pm
Location: Edinburgh, Scotland
Contact:

Strategy to construct a Stack

Post by tlottrike » Mon Dec 17, 2018 5:34 pm

I am trying to plan what strategy I should use to create a sort of Database that keeps records of the buildings we have built. Each building would have basic information like Client, Cost, Number of Storeys etc.

My first thoughts are the user would create a new card based on which building type they are going to record.

The Stack would have a script that would create a new card using a "template script" to make a card that suits each building type.

The Database would have to be viewable and editable by up to 10 users. This last bit I have no idea how Livecode deals with networking different users or even if that is a problem. Hence why I am wondering if this is even the right way to proceed and I should be looking at using some kind of proper database eg SQL ?

Thanks in advance for any advice
Graeme
IMac MacOSX 10.13
Livecode 9.0.0 Build 15103

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

Re: Strategy to construct a Stack

Post by FourthWorld » Mon Dec 17, 2018 5:46 pm

Will the system be used exclusively on your local network, or will any users connect over the Internet?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

tlottrike@gmail.com
Posts: 6
Joined: Sun Jul 15, 2018 9:30 pm
Location: Edinburgh, Scotland

Re: Strategy to construct a Stack

Post by tlottrike@gmail.com » Mon Dec 17, 2018 9:19 pm

It will be on our local area network

Thanks
Graeme

Mac iMac 2012
MacOS 10-15
Livecode 9_6_4

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: Strategy to construct a Stack

Post by quailcreek » Mon Dec 17, 2018 9:52 pm

Hi and welcome to the forum.
I would suggest that instead of creating cards on the fly, you have a card for each building type pre-created. Then, on your home cards, you could have buttons or some other means for the user to navigate to the desired building type card. I would also recommend that you have a column for the building type in your DB, then use this column data to navigate to the proper building type card in your stack and populate the rest fo the building data on the card from information in your DB.
Tom
MacBook Pro OS Mojave 10.14

tlottrike@gmail.com
Posts: 6
Joined: Sun Jul 15, 2018 9:30 pm
Location: Edinburgh, Scotland

Re: Strategy to construct a Stack

Post by tlottrike@gmail.com » Mon Dec 17, 2018 11:53 pm

I was hoping not to have to retrieve data from a database but merely create cards which retain the data. Not every building even when split by type will be the same and so retrieving data from a database may get complex or I would have to have separate databases for each building type but even then a 1500 pupil school isn’t the same as a small nursery for 100 children but they are both educational buildings :)
Graeme

Mac iMac 2012
MacOS 10-15
Livecode 9_6_4

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: Strategy to construct a Stack

Post by quailcreek » Tue Dec 18, 2018 12:15 am

You could have one DB with a table for each building type. A DB approach would allow for the 10 users you said you wanted. Having 10 users access a single LC stack over a network would cause you a lot more trouble than setting ups a well thought out and designer DB. The DB would also be much faster especially if you have 500 buildings top track. Just my thoughts.
Tom
MacBook Pro OS Mojave 10.14

tlottrike@gmail.com
Posts: 6
Joined: Sun Jul 15, 2018 9:30 pm
Location: Edinburgh, Scotland

Re: Strategy to construct a Stack

Post by tlottrike@gmail.com » Tue Dec 18, 2018 12:29 am

Ah thanks for that info. Am I right in saying I would need to run a database server to host the databases? If so what kind of app would I need?
Graeme

Mac iMac 2012
MacOS 10-15
Livecode 9_6_4

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: Strategy to construct a Stack

Post by quailcreek » Tue Dec 18, 2018 12:40 am

LC offers server software but there are others.

https://downloads.livecode.com/livecode/
Tom
MacBook Pro OS Mojave 10.14

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9660
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Strategy to construct a Stack

Post by dunbarx » Tue Dec 18, 2018 1:03 am

The issue is record locking. LC server probably (I don't use it) finds a way to manage that.

I think that you should create new cards each time a new building is added, from a template. Then you just clone as you go. This is simple to do.

Craig Newman

tlottrike
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 11
Joined: Mon Oct 31, 2011 3:46 pm
Location: Edinburgh, Scotland
Contact:

Re: Strategy to construct a Stack

Post by tlottrike » Tue Dec 18, 2018 3:54 pm

Cheers for that, I think as a starting point the way you describe is the way I am going to go for now just to get some of our more recent Projects catalogued and me a bit more up to speed with LiveCode :shock:

Ultimately it will have to become a proper database as over the 20 or so years we have archived 360 Projects. So I'm thinking an SQL database for each Building Type with a corresponding Stack that calls the info in.

Thanks again
IMac MacOSX 10.13
Livecode 9.0.0 Build 15103

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7233
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Strategy to construct a Stack

Post by jacque » Tue Dec 18, 2018 5:02 pm

Another approach is to store the building info in an array if you don't need all the functionality of a database. Arrays are very fast and 360 buildings isn't a very large number. The array can be stored in the stack itself or in an external file. But the decision depends a lot on how you'll use the data and what it contains.

Do you need to look up only the building name, or will you need to search by more specific criteria? Complex searches are better with a database. Searches by a single key work well with arrays or even just card-based field data. Using the stack itself as storage is very doable with only 360 cards.

Will each building have the same types of information stored? If so, a single card that loads the fields dynamically works well. If each building has unique information then different cards with permanent data would be a good choice.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9660
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Strategy to construct a Stack

Post by dunbarx » Tue Dec 18, 2018 5:36 pm

All,

Just so I understand the important issues, is it not the fact that multiple users might be trying to access the data at the same time?

Record locking.

The structure of the stack without that issue seems simple; a card for every building, and some gadgetry.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7233
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Strategy to construct a Stack

Post by jacque » Tue Dec 18, 2018 6:26 pm

You'd only need record locking if users are allowed to edit the data. If so, a lock file on the server is the usual approach.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9660
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Strategy to construct a Stack

Post by dunbarx » Tue Dec 18, 2018 6:41 pm

Jacque.

The OP originally proposed ;
The Database would have to be viewable and editable by up to 10 users.
Craig

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

Re: Strategy to construct a Stack

Post by MaxV » Wed Dec 19, 2018 5:38 pm

tlottrike wrote:
Mon Dec 17, 2018 5:34 pm
I am trying to plan what strategy I should use to create a sort of Database that keeps records of the buildings we have built. Each building would have basic information like Client, Cost, Number of Storeys etc.

My first thoughts are the user would create a new card based on which building type they are going to record.

The Stack would have a script that would create a new card using a "template script" to make a card that suits each building type.

The Database would have to be viewable and editable by up to 10 users. This last bit I have no idea how Livecode deals with networking different users or even if that is a problem. Hence why I am wondering if this is even the right way to proceed and I should be looking at using some kind of proper database eg SQL ?

Thanks in advance for any advice
Graeme
SQlite is inside livecode, I suggest to use it:
https://livecode.wikia.com/wiki/SQLite
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”