Forum Academy Marketplace Showcase Pricing Features

How to I update a list variables value

I have a variable that is a list called “watched”. It represents a list of videos within a course that have been watched.

This is NOT related to the database. In other words, the watched list is only updated on each page visit and is agnostic to who the user/viewer is.

Here is the workflow that seems to be giving me trouble:

When debugging, I see this error:

Am I using the wrong function to update this variable?

@hegartyjonc

I’m not entirely sure what the var-watch list, is this displaying the repeating group of videos on the page?

If so, you might want to try adding a frontend state to this, for example you could do it like this:

  1. Set up a state somewhere on the page. Make the data type “~videos” and check “list”.
  2. When the video is clicked have a workflow “Set State” with the same things you’ve got set up (take the existing list plus the clicked video only if the clicked video isn’t in the state).
  3. Show your clicked videos in the repeating group by using the state as the data source.

If you want to have a list of all the videos but only show a indicator if they’ve been watched you could use the same state for that by:

  • Having the data source of the repeating group be all of the videos.
  • Add an indicator in the first cell and set its conditional for visibility or visuals if the watched-state contains this cell’s video.

Hope this might help,

Adam

Hey Adam, thanks for the reply. No, “var watched” is a hidden variable on the page that I’m using solely to keep stock of which videos have been watched. I agree that a custom state might be a better option.

Just not sure why I can’t increment the list of videos. I’m using it similar to a custom state – but I thought the “display list” function would work to update the list’s value all the same

@hegartyjonc, I understand the “display list” function to be used to update the “thing” of a group and what to show inside it. In order to store data on the front-end and use it for reference I’ve always found states to work well. You can increment the states just the way you’re trying to do with the existing function so I think it might be what you need.

Good luck!