Datagrid persistent data setting

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

Post Reply
phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Datagrid persistent data setting

Post by phaworth » Sun Jun 06, 2010 11:35 pm

The Datagrid manual describes the Persistent Data setting as "Set to true if you would like the data grid to store the data being displayed between sessions. The
data grid always works with data stored in a script local variable but if this value is true then the data will be cached in a custom property as well".

Does this apply to standalone applications? I'm under the impression that custom property values are not preserved between runs of a standalone application without invoking the splash stack/application stack workaround.

Thanks,
Pete

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Re: Datagrid persistent data setting

Post by trevordevore » Mon Jun 07, 2010 5:35 pm

The data will still be stored in the custom property but it won't be saved to the stack file unless you explicitly save the stack file yourself.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: Datagrid persistent data setting

Post by phaworth » Wed Jun 09, 2010 5:52 pm

Thanks Trevor. The reason for asking is that I've just run into the issue that data, including custom properties, cannot be saved in a standalone app and working on finding ways around that. The persistent data setting made me wonder if you had found a way round that, aside from the usual recommendation of having an initial splash stack that just calls the real application stack.
Pete

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Re: Datagrid persistent data setting

Post by trevordevore » Wed Jun 09, 2010 5:55 pm

I don't know of any other approach other than the one you mention. I *always* store data outside of the application itself (in user folders) and then load the data up when the application launches. Less chance of headaches regarding permissions this way.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: Datagrid persistent data setting

Post by phaworth » Wed Jun 09, 2010 6:11 pm

I agree with always storing stuff outside the app. I use an sqlite db for the user data but got caught with the issue of custom property settings that need to survive across runs. I've changed everyting to store such settings in an external file now and used setProp and getProp handlers in my main stack's script to deal with keeping the file in sync with the custom props.

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Re: Datagrid persistent data setting

Post by trevordevore » Wed Jun 09, 2010 6:49 pm

Is this file basically serving as your pref file?
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: Datagrid persistent data setting

Post by phaworth » Wed Jun 09, 2010 7:30 pm

Actually, I have two files, both in the user's Preferences folder (using Sarah Reicheldt's script to get the path to it on Mac and Windows). I use a settings.txt file to hold preferences and a properties.txt file to hold the info about custom properties with persistant data. Using two files mainly because the format is a little different and also just because seems like properties are a different beast than preferences. Doing this means I don't have to use the splash/app stack separation which I wasn't keen on for a number of reasons.

Turns out I don't need to use the persistent data option for datagrids due to the logic of my app.

Pete

Post Reply