Know the number of elements in a list

Hello,
I want to know how many images are stored in a custom state or in a file uploader (so if you upload 10 pics, I should have “10” at the end)
So I thought that I needed to use the :count formula but it doesn’t work, after that it asks me to enter other stuff and it doesn’t work.
How can you do that please ? I’ve been stuck for 2+ hours.
THank you very much

:count is correct, so if it’s not working then you must be doing something wrong somewhere.

What does it say on the issue checker when you try to do it?

Maybe post a screenshot or two if you want someone to be able to help.

@lucaspenanguer

Use a group call it “var - multi file uploader count”

Set it to to type of content “number”

Place a multi file uploader element on the page

Set the group’s data source to ‘multi file uploader’s :count”

Set a text element to display “var multi file uploader’s value”

Preview the page

Upload a few files

… give it a few seconds for the files to upload…

.The text element should show show the count of files in the mfu element

You can use the “var … “ in flows and conditions


EDIT : the problem comes from the “choices source” (no problem to enter the var’ value in the placeholder).
I think I am right to say that I need to enter a list that is “1 2 3 … var count”.
So I need to generate automatically such list. Do you know how can I? I thought of creating a custom state but after I’m blocked. Ty

What are you trying to show in your dropdown?

The choices source needs to be the data source of the options you’re displaying in the dropdown list. It needs to match the datatype, in this case ‘Number’, so you need to set the data source to be a list of numbers (assuming that is what you’re trying to do).

You said you wanted to display the number of files in the uploader, so where are you trying to display that number, and what does that have to do with a dropdown?

Hello,
I want to let the users decide the order of the pictures they uploaded . Because I noticed that if you upload several pictures with the multi-file uploader, the one you selected first wont be uploaded first on the plateform and will be for instance #2 or ~#4. Because I want to create a social media, people should be able to decide the order of the pictures.
So if there are 4 pictures, they should be able to choose a number from 1 to 4, but I can’t manage to make such list.

Right, ok (I don’t see what that has to do with your original question? Or is this a separate question?)

In any case, to achieve what you’re trying to do here you’ll first need to make sure your database is set up correctly in order to store the order of images.

So make sure you have a datatype for your images.

This datatype needs to have fields for User (of type User), Image (of type image), and Image Number (of type Number), and any other data relating to the image.

When an image is uploaded, create a new ‘Image’ thing in the database, containing the image file, and connect it to the User, and set the image number however you like.

There are various ways you can set and change the image number depending on the UX and design you’re trying to achieve, including dropdowns, drag and drop, text inputs, icons, etc.

It all depends on your design, but to allow users to change the order of images at a later point you’ll need to use a workflow to change the image number of the image in question, as well as figure out a way to either update all the subsequent image numbers, or maybe you could ‘insert’ the selected image between 2 existing numbers (i.e. using a decimal), so you don’t need to update the entire list for that user.

1 Like

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