Using Custom States for unconventional data types

Hi, I’m trying to use custom states as a way of temporarily storing data before it is stored in a database as a way of improving my website’s performance. The data type though consists of a text component and an option component.

I’m finding that this is a bit more difficult than anticipated as Bubble only allows you to set one value for each Custom State with the ‘Set Custom State’ event.

Any ideas on how I could do this?

Thanks!

1 Like

You can create multiple states. Also a list of texts can be used if it serves your purpose

I know I can create multiple states. It’s just more convenient to have them in one state.

If the data you want to store in a same state is of same type, you can create a state as a list, let say of texts.
And when storing the data, you set the list to itself combined with the :plus-item to add an item to the list.
You can combine as much :plus-item one after the other as you want.

Then you can access individual items with my list of text's:item #nn.

If you want to remove a particular item, say, in the middle of the list, you can set the state to itself with :minus item with the value: my list of texts :item #nn.