How to save and load card data (on card file db)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
How to save and load card data (on card file db)
OK so I am slow learner, must be getting too old for this, but how do i save data input into card fields to card db, and then load the data on opening the stack again?
Thanks in advance for the help.
Thanks in advance for the help.
Regards
Gil
Gil
Re: How to save and load card data (on card file db)
Hi herveyq,
Welcome to the forum!
Let me ask a question first. How many fields will need to be recorded in the end? 100's/1000s/10000s/more?
You mention db (database), now I know people who will swear an Excel spreadsheet is a database, but it's not. Do you already have a db background?
liveCode gives you plenty of ways to record info.externally. db/txt/stack
Simon
Welcome to the forum!
Let me ask a question first. How many fields will need to be recorded in the end? 100's/1000s/10000s/more?
You mention db (database), now I know people who will swear an Excel spreadsheet is a database, but it's not. Do you already have a db background?
liveCode gives you plenty of ways to record info.externally. db/txt/stack
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: How to save and load card data (on card file db)
If there are few data I suggest arrayEncode and arraydecode into a file, otherwise use SQLite db, since SQLite is embedded in Livecode.
See also:
See also:
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: How to save and load card data (on card file db)
Hi Simon and Max,
I thought it was possible to save small amounts of information on the stack, so that is one thing for this project to be small and self contained on a phone. The other option is to use the included database or MYSQL for my larger base with external.
Simon, I started looking at database against spreadsheet in 1982. I kept to known RAD programs, Clarion, Windev and produced large database systems and a ticketing system for passenger transport. Now I am looking at hobby use only and wanted to get away from expensive options where there would be no financial return so looked around and came to what appears to have been Revolution.
After a heart attack, getting back on the wagon has it's challenges, so your help is most appreciated.
Fields, usually only in the hundreds using the KISS principal. Never anything really clever that can go wrong always KISS and I don't have to support as it just keeps running.
I thought it was possible to save small amounts of information on the stack, so that is one thing for this project to be small and self contained on a phone. The other option is to use the included database or MYSQL for my larger base with external.
Simon, I started looking at database against spreadsheet in 1982. I kept to known RAD programs, Clarion, Windev and produced large database systems and a ticketing system for passenger transport. Now I am looking at hobby use only and wanted to get away from expensive options where there would be no financial return so looked around and came to what appears to have been Revolution.
After a heart attack, getting back on the wagon has it's challenges, so your help is most appreciated.
Fields, usually only in the hundreds using the KISS principal. Never anything really clever that can go wrong always KISS and I don't have to support as it just keeps running.
Regards
Gil
Gil
Re: How to save and load card data (on card file db)
Hi herveyq,
First thing to know is that a standalone (.exe .app .apk whatever) cannot save information to itself. None Nil Nada.
What applications do is save information to external files.
New stack 1 button, in the button script
Now when you press the button a new file will be created and read (if it's not there already).
Edit Test.txt with an editor and change the text inside and save the file.
Now when you click on the button it will show the new text.
Give that a go and tell me how you get on, we can talk about sqLite database later as well if you like.
Simon
First thing to know is that a standalone (.exe .app .apk whatever) cannot save information to itself. None Nil Nada.
What applications do is save information to external files.
New stack 1 button, in the button script
Code: Select all
on mouseUp
set the defaultFolder to specialFolderPath("desktop") --This is the folder where things will be saved to
if there is a file "Test.txt" then
put url "file:Test.txt" into readFile --readFile is a made up variable name, almost any word will do but some are "reserved words"
answer readFile --show the contents of the file
else
put "I was read from disk" into writeFile
put writeFile into url "file:Test.txt" --write a new file
put url "file:Test.txt" into imANewFile
answer imANewFile --show the contents of the file
end if
end mouseUp
Edit Test.txt with an editor and change the text inside and save the file.
Now when you click on the button it will show the new text.
Give that a go and tell me how you get on, we can talk about sqLite database later as well if you like.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: How to save and load card data (on card file db)
Thanks Simon,
I probably go the sqLite route to maintain data types, even though I only want to record one record and tect will do for that. Will test and advise.
Gil
I probably go the sqLite route to maintain data types, even though I only want to record one record and tect will do for that. Will test and advise.
Gil
Regards
Gil
Gil
Re: How to save and load card data (on card file db)
Hi Gil,
Lets add some more
put
"I am line 1 of file Test.txt"
"I am line 2 of file Test.txt"
into the Test.txt file and save it.
Replace
with
With that you can see how to build a complete record of the fields contents.
Simon
Lets add some more
put
"I am line 1 of file Test.txt"
"I am line 2 of file Test.txt"
into the Test.txt file and save it.
Replace
Code: Select all
answer imANewFile --show the contents of the file
Code: Select all
answer line 2 of imANewFile --show the contents of the file
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!