Set state: add numbers to a list of numbers

Why is it so freaking difficult to manipulate a simple array (list of numbers)?

I have a custom state (list of numbers) and I want to populate it with … well numbers, duh.
Set State … and then? I can’t refer to a specific position in the list.
Even tried [first part of the list] + number + [rest of the list]
but doens’t work either.

Working with arrays is such a basic basic functionality, and I have to find a new trick every time. It’s honestly abysmal.

Any suggestions? I’m just trying to add some slider values to a list of numbers…

Hi @Jett,

Can you share an example what kind of rule of position when you want to add new number to the list?

If you just want to add new number to the end of the list, you can use plus item function. Something like this:
image

hey @hadirs,

That won’t do.
I have 10 sliders, and I need the values of those sliders in a list every time they change.
So when I move slider 8 to value x, I want value x in the list on position 8.

How about setup a datatype to handle your list data?

You can set simple datatype like this
image

You can use repeating group to display the list data, put slider inside Repeating group, and set workflow to change the data when slider value change like this

I’m trying to avoid this specifically. It’s just not good practice to do a call to the database every time you change a slider. It’s way overkill and will slow things down a lot (I’ve tested this). There’s really no need for this to be put in a DB, and should be handled on the frontend.

I appreciate the effort though @hadirs

1 Like

Consider using a plugin to generate a list of numbers on the front end. This way you can keep all your slider state calcs there. :+1:

2 Likes

Hey @cmarchan,
Thanks for the suggestion.
How would I reference this ListOfNumbers in a Workflow?
It doesn’t show up.

Place the list of numbers element on the page. You can then reference it in your flows. Do not forget to set it up as needed :+1:

Don’t see how this is a solution. I still can’t access the individual values in the list.
I need to put value X in the list at position Y.
For the life of me, I don’t understand why this is so hard to do. It’s the most basic thing in any programming language.

You have 10 sliders … so … create 10 custom states of type number on the page

and how does that give me a list of values?

It doesn’t.

The objective is to manage the sliders with front page actions.

Or you can create an option sets list that you add to the list or remove from the list. If an option is on that list the slider can act. Each option set can have number attributes, Though these numbers will be hard coded you could still conditionally use them to have the sliders react to them.

Uhm no, the objective is to get a list of numbers containing the sliders’ values.
As mentioned in my first post … “I’m just trying to add some slider values to a list of numbers…”

Ok. Just took a stab at it. Hope this helps:

Screen Recording 2021-01-19 at 02.14.52.39 PM

This topic was automatically closed after 70 days. New replies are no longer allowed.