Saving the value of a counter after experience restart

I’m looking for a way to save the value of a counter so that it can be accessed after the experience is restarted. The only way I can think of to do this is with an excel interface asset.

We’re asking users to select one of six options and then add the selection to the total number of clicks for that option. I have an excel interface asset that has the current amount of clicks for each option. The click should add one to the counter/update the excel cell. Then display a total on a results scene.

It basically functions like a quiz, but the results have to stay in the system and not reset.

Hi @John and welcome to the Intuiface community!

If you have only 1 device / player / XP running and need to save that value locally on the device, then indeed Excel is the simplest / fastest solution.

One small warning if you are using Player 8 (vs Classic): as listed in this article section, “Excel updates are not persistent when using Composer’s Preview mode, meaning that any Excel changes at runtime will not be saved.”
The changes will be saved when running your XP within an installed Player.

You have multiple options to perform these actions, using either a Simple Counter or our newer Simple Maths (Player 8 only) Interface Asset for example, but in a nutshell, when you need to save your new count

  • Retrieve the latest saved value from your Excel file, set it in the Counter or Maths Interface Asset
  • Add your current count to that value
  • Update the Excel cell with the newly computed value to save.

Let us know if you need any additional info on that topic.

Seb

Thank you for your feedback!

I just learned that the experience will need to run on at least 2 devices, with 2 different players. I was hoping I could do the persistent count locally with excel, but that might not be an option.

You “could”, which may not mean you “should” :smile:

I can think of 2 options:

  • You stick to using Excel, but you make one of your 2 XPs the “Main/Master” (the one in charge of the counting) and the other one (or ones if you had more than 2 XPs) the “Secondary/Slave”.
    • If you’re using Player Classic, you can use Local Network Triggers to communicate between your XPs
    • If you’re using Player 8, you have to use Web Triggers.
    • See a similar use case in this Entrance Flow Management sample
  • You switch to an “online database” such as Airtable, where both your XPs will act the same, updating the value stored in that database using our API Explorer.

Let me know your thoughts on these.

Seb

Thanks for your help with trying to find a solution to the problem.

I think that I’ve decided that the experience should only run on one device. This is a really complicated solution just to update one number at a time, and the internet connection could be unreliable. The new ‘headless CMS’ can’t help with this situation?

Hi @John,

As of today, you can’t write information within the H-CMS from an experience. Even if you could, if your internet connection could be unreliable, this wouldn’t be an option I would suggest.

Going with an Excel file will be the best and easiest option, whether you have 1 or more devices.
Even with an unreliable internet connection, using the Local Network Trigger would always work to communicate the information between Player Classics over your local network.

It’s been a while since we last talked, let me know if you’d like to jump on a call sometime next week if you want to discuss this solution further.

Seb