Saving user modifications to Table Data
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Saving user modifications to Table Data
I am trying to put a few fields of data into a table and then be able to populate those fields with the table data when the app opens.
The data in the table reverts to the data that was in the table before it was modified by the user when the app is closed.
What am I missing?
I have just a few lines (5 right now) that I would like to have a new user enter the first time he uses the app and modify later if required. Phone number, email address etc.
Tom
The data in the table reverts to the data that was in the table before it was modified by the user when the app is closed.
What am I missing?
I have just a few lines (5 right now) that I would like to have a new user enter the first time he uses the app and modify later if required. Phone number, email address etc.
Tom
Re: Saving user modifications to Table Data
My preferred method of doing this is to create another stack. create custom properties of the stack for each of the variables you want to save. Do not save that stack as a stand alone. When the user enters his information, set the custom properties of that stack to those values. To load those values just put in an openStack script that reads them and puts them where you want them.
Hint: don't forget to save that stack after setting custom properties.
Hint: don't forget to save that stack after setting custom properties.
Re: Saving user modifications to Table Data
Do I create the stack from within the app? If not how is that stack distributed to new devices?magice wrote:My preferred method of doing this is to create another stack. create custom properties of the stack for each of the variables you want to save. Do not save that stack as a stand alone. When the user enters his information, set the custom properties of that stack to those values. To load those values just put in an openStack script that reads them and puts them where you want them.
Hint: don't forget to save that stack after setting custom properties.
I'm really new at this.
Thabks
Tom
Re: Saving user modifications to Table Data
Create it separately, and include the file as an external. An .exe file cannot save itself or another .exe but it can change and save a .rev/.livecode file.trags3 wrote:
Do I create the stack from within the app? If not how is that stack distributed to new devices?
I'm really new at this.
Thabks
Tom
Re: Saving user modifications to Table Data
Thanks, Ill try that. Here are the steps as I understand themmagice wrote:Create it separately, and include the file as an external. An .exe file cannot save itself or another .exe but it can change and save a .rev/.livecode file.trags3 wrote:
Do I create the stack from within the app? If not how is that stack distributed to new devices?
I'm really new at this.
Thabks
Tom
1. create a new mainstack file with 1 card and a simple table as an object on the card.
2. set the properties of the card to fit my data needs.
3. include the .livecode stack file in the externals when I create the .apk file for the main app.
Is that about right?
Appreciate the help.
Thanks
Tom
Re: Saving user modifications to Table Data
That is the basics of the process. I'm sure you can figure out the details. If you have more questions, let us know.trags3 wrote:
Thanks, Ill try that. Here are the steps as I understand them
1. create a new mainstack file with 1 card and a simple table as an object on the card.
2. set the properties of the card to fit my data needs.
3. include the .livecode stack file in the externals when I create the .apk file for the main app.
Is that about right?
Appreciate the help.
Thanks
Tom
Re: Saving user modifications to Table Data
I am sure Magice and you can work this out.
Just so I understand, when you said, in your initial post, that you saved data to a "table", did you mean to a variable? A table normally means a table field, an object who's contents survives sessions. I am confused, because you also said that the data in the "table" reverts to some earlier contents. No variable could do this, even if it were useful to do so.
Anyway, you do not need another stack, Use custom properties directly. These survive between sessions, and can hold much more varied data than a variable could ever dream of, if the need arises.
Craig Newman
Just so I understand, when you said, in your initial post, that you saved data to a "table", did you mean to a variable? A table normally means a table field, an object who's contents survives sessions. I am confused, because you also said that the data in the "table" reverts to some earlier contents. No variable could do this, even if it were useful to do so.
Anyway, you do not need another stack, Use custom properties directly. These survive between sessions, and can hold much more varied data than a variable could ever dream of, if the need arises.
Craig Newman
Re: Saving user modifications to Table Data
Hi Tom,
Here is the lesson on it:
http://lessons.runrev.com/s/lessons/m/4 ... pplication
I actually prefer to use a plain text file as it's easy to open and read but a stack can hold binary data (images).
(if Craig is right then don't read this post)
Doh!
Simon
Here is the lesson on it:
http://lessons.runrev.com/s/lessons/m/4 ... pplication
I actually prefer to use a plain text file as it's easy to open and read but a stack can hold binary data (images).
(if Craig is right then don't read this post)
Doh!

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Saving user modifications to Table Data
I am trying to learn and use the table with custom properties approach to this problem.
On a card I have 5 text entry fields that I can enter agent information in.
Name, Cell, Office phone,etc. I have a table field tagentinfo with 5 custom properties agentname,agentcell etc.
I have a button to press when edits are complete. This is the example code for one of the entry field's data I have for the button.
On mouseUp
put the agentname of fld "tagentinfo" into "tvar"
put fld "Aname" into "tvar"
set the agentname of fld "tagentinfo" to "tvar"
end mouseUp
The script stops on the set command.
This is how Ii understand the user manual suggests this kind of operation but I am still missing siomething.
Tom
On a card I have 5 text entry fields that I can enter agent information in.
Name, Cell, Office phone,etc. I have a table field tagentinfo with 5 custom properties agentname,agentcell etc.
I have a button to press when edits are complete. This is the example code for one of the entry field's data I have for the button.
On mouseUp
put the agentname of fld "tagentinfo" into "tvar"
put fld "Aname" into "tvar"
set the agentname of fld "tagentinfo" to "tvar"
end mouseUp
The script stops on the set command.
This is how Ii understand the user manual suggests this kind of operation but I am still missing siomething.
Tom
Re: Saving user modifications to Table Data
Hi Tom,
I guess tvar is a variable, right?
Then do NOT put quotes around it, or it will turn into a simple string!
...
put the agentname of fld "tagentinfo" into tVar
## This will overwrite the content of the custom prop of your field with a new value in the variable!
put fld "Aname" into tVar
set the agentname of fld "tagentinfo" to tVar
...
Best
Klaus
I guess tvar is a variable, right?
Then do NOT put quotes around it, or it will turn into a simple string!
...
put the agentname of fld "tagentinfo" into tVar
## This will overwrite the content of the custom prop of your field with a new value in the variable!
put fld "Aname" into tVar
set the agentname of fld "tagentinfo" to tVar
...
Best
Klaus
Re: Saving user modifications to Table Data
Thanks everyone. I am slowly getting it.Klaus wrote:Hi Tom,
I guess tvar is a variable, right?
Then do NOT put quotes around it, or it will turn into a simple string!
...
put the agentname of fld "tagentinfo" into tVar
## This will overwrite the content of the custom prop of your field with a new value in the variable!
put fld "Aname" into tVar
set the agentname of fld "tagentinfo" to tVar
...
Best
Klaus
Tom
Re: Saving user modifications to Table Data
Glad to hear it.
Why do you place the contents of the custom property into the variable, and the immediately place the field contents into that variable. The second will replace the first, correct? It looks like you do not need the first line.
Craig
Why do you place the contents of the custom property into the variable, and the immediately place the field contents into that variable. The second will replace the first, correct? It looks like you do not need the first line.
Craig
Re: Saving user modifications to Table Data
Thanks Craig, I only did that because I was copying the example on pg 223 of the User Manual.dunbarx wrote:Glad to hear it.
Why do you place the contents of the custom property into the variable, and the immediately place the field contents into that variable. The second will replace the first, correct? It looks like you do not need the first line.
Craig
Going back and looking at that I think they are changing just 1 word in a longer string.
I am changing the whole thing so I think you are correct.
Tom
Re: Saving user modifications to Table Data
magicemagice wrote:That is the basics of the process. I'm sure you can figure out the details. If you have more questions, let us know.trags3 wrote:
Thanks, Ill try that. Here are the steps as I understand them
1. create a new mainstack file with 1 card and a simple table as an object on the card.
2. set the properties of the card to fit my data needs.
3. include the .livecode stack file in the externals when I create the .apk file for the main app.
Is that about right?
Appreciate the help.
Thanks
Tom
I seem to have everything working within Livecode IDE.
When I open the Main app and the Project browser I also need to open the AgentData stack that contains the table of stored data.
What is stumping me is how to include the AgentData stack when I build the app to test on my phone. For that matter when I build the apk file how do I include the AgentData stack as an external?
Tom
Re: Saving user modifications to Table Data
In the standalone application settings, go to the stacks tab. Hit the add stack file button and choose you stack. This will include that stack with your stand alone app.