4

I have an app that allows the user to enter a name and other relevant information to be used in submitting a request to a web service. I'd like to store that and use it to pre-fill the form the next time the app runs.

Entity variables would be great for this, except that in most cases I want the data to persist longer than just one session. It's not really a problem for them to enter it again every time, since the data is simple and not sensitive. But it would be nice to be able to hold on to that data as long as possible.

In a regular web app, I would just set a cookie with an expiration date of 3 months or something. Is there a way to use entity variables in this way (i.e., longer than one session)?

Steve Nay
  • 2,819
  • 1
  • 30
  • 41

1 Answers1

3

I'm glad you ask because I think you may have misunderstood entity variables.

Entity variables are the correct thing to use for what you are trying to do.

Entity variables in KRL will persist for a user as long as the kobj.net cookie persists in their browser

alt text

This means that if you use an entity variable to save a users name and other data, your app will still have access to that as long as that cookie is in their browser.

*THE FUTURE

In the future, the platform will support a better mechanism for syncing these "sessions" across multiple computers and browsers. This will allow a user to restore their "session" with the system if they loose their cookie or move to a different computer or browser.

In the mean time, because heaven knows when "The Future" will be upon us, you can save information in the entity variable AND back it up to a place like StringBin. Then in your app, when you check for saved data in the entity variable and there isn't any, you can also check StringBin to see if the user's data has been backed up there. If it has then you can "restore" the data and the user continues using the app never knowing any better of the awesomeness that you just did.

Mike Grace
  • 16,636
  • 8
  • 59
  • 79
  • 1
    Awesome! You're right; I was misunderstanding the life span of entity variables. Thanks for the clarification! – Steve Nay Dec 24 '10 at 17:35