How to load/save a list of strings when opening/leaving an app?

Former Member
Former Member
I'm trying to understand how i can save a string (dates+words+numbers, separated by spaces) to a log when leaving my app, and then have the log reload when the app is started back up again.

I know the ObjectStore sample is meant to illustrate how it works (i think!), but i'm not really following the logic.

Could someone sketch out what's needed in code? Would be much appreciated.

Thanks.
  • Yes, the ObjStr sample shows it. The first screen of the sample is the ObjStr, the second page is for properties (like app settings). What's a bit confusing is they both use the same calls.

    In the sample, OS values use numbers for keys, while properties use strings. The OS is in the .str file for your app, the properties, in the .set

    To store something, you use "setProperty(key, value)", so something like "setProperty("key1", "save this string");"

    (if you don't have "key1" as a property, it will go in the OS)

    To get it back, it's something like "var key1str=getProperty("key1");"

    For me, I read the data in initialize(), and for saving it, I make the call whenever it changes, as the values will actually be written to the .str when you exit (if you crash, they likely won't be written)
    (the .str is limited to 8k IIRC)

    If you want to save a bunch of strings, you can probably put them in an array or dictionary and just save/read that with a single key (I do it with an array for floats for example)
  • Former Member
    Former Member
    Makes sense and seems to be working now. Thanks Jim!
  • I started using the Object Store long before CIQ had app setting. In fact that's how I did customization - send out a new .str file...

    It's a really nice thing, but since it uses the same calls as the "properties" it can be a bit hidden and confusing :)