Page 1 of 2
Strategy to construct a Stack
Posted: Mon Dec 17, 2018 5:34 pm
by tlottrike
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
Re: Strategy to construct a Stack
Posted: Mon Dec 17, 2018 5:46 pm
by FourthWorld
Will the system be used exclusively on your local network, or will any users connect over the Internet?
Re: Strategy to construct a Stack
Posted: Mon Dec 17, 2018 9:19 pm
by tlottrike@gmail.com
It will be on our local area network
Thanks
Re: Strategy to construct a Stack
Posted: Mon Dec 17, 2018 9:52 pm
by quailcreek
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.
Re: Strategy to construct a Stack
Posted: Mon Dec 17, 2018 11:53 pm
by tlottrike@gmail.com
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

Re: Strategy to construct a Stack
Posted: Tue Dec 18, 2018 12:15 am
by quailcreek
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.
Re: Strategy to construct a Stack
Posted: Tue Dec 18, 2018 12:29 am
by tlottrike@gmail.com
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?
Re: Strategy to construct a Stack
Posted: Tue Dec 18, 2018 12:40 am
by quailcreek
LC offers server software but there are others.
https://downloads.livecode.com/livecode/
Re: Strategy to construct a Stack
Posted: Tue Dec 18, 2018 1:03 am
by dunbarx
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
Re: Strategy to construct a Stack
Posted: Tue Dec 18, 2018 3:54 pm
by tlottrike
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
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
Re: Strategy to construct a Stack
Posted: Tue Dec 18, 2018 5:02 pm
by jacque
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.
Re: Strategy to construct a Stack
Posted: Tue Dec 18, 2018 5:36 pm
by dunbarx
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
Re: Strategy to construct a Stack
Posted: Tue Dec 18, 2018 6:26 pm
by jacque
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.
Re: Strategy to construct a Stack
Posted: Tue Dec 18, 2018 6:41 pm
by dunbarx
Jacque.
The OP originally proposed ;
The Database would have to be viewable and editable by up to 10 users.
Craig
Re: Strategy to construct a Stack
Posted: Wed Dec 19, 2018 5:38 pm
by MaxV
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