List of Items in Custom State from URL Parameter

Hello everyone…

How to put a list of items in the custom state from URL Parameter.
I know how to do with a single item but I can’t find how with a list.

Thanks
Fabian

1 Like

[list of things]:each item's unique id:joined with "-"

Then on the new page Do a search for [the datatype] with the constraint unique id is in [your URL parameter]:split by "-"

It is an Option Set. And here is what I’m trying to do.

I have Repeating Group displaying colors which should be selected when the Custom State is filled from URL Parameters

image

Thanks for your answer
Fabian

This could help

You might also be able to use Get Data From URL parameter and set the data type of the Parameter to the type of custom data you created in your app only if you are sending the unique ID of each item in the URL parameter (Bubble automatically detects the entry when you specify the data type in the Get data from URL expression, so no need to do a search)…this definitely works for a single item, but not sure if it will also work for a list of items.

Test it out by putting a text element on the page, and a dynamic expression for Get Data from URL parameter to see how Bubble URL decodes the list of parameters (does it come back with a delimiter of a comma or does it use the URL coded value)…if it URL decodes and separates the values with a comma, then you can do Get data from URL parameter, set the type and then use the split by operator with the split being a comma…Bubble should be able to recognize each item without a search (again only if you are using the unique IDs)…if you are using anything other than the unique IDs then the above link will help.

1 Like

Yeah, I’m not using the unique ID.

I see it is a Sample Project. Can you share the Editor to avoid multiple questions, please?

Thank you for your answer
Fabian

Update:

I tried what you did and it selected every item on page load

For an option set just use the Display attribute, joined with a comma.

What do you mean? Can you elaborate more, please?

List of options: each item’s display: joined with ,

Then on your destination page:

Get all options: filtered: display is in: get data from url (text) split by ,

There isn’t is in

Maybe that’s why Boston did it backward because there is: is not in

Or maybe I’m not getting it right

Thanks
Fabian

Yeah, I’ve been asking Bubble for years to add the oh so obvious is in operator; not holding my breath for that to be available anytime soon.

Ah ok, so just do it the other way round (i.e. list from URL contains this option’s display)

@boston85719 I tried your approach and I have no results. Can you give me a hand please, since you had success with this method?

It doesn’t work either

It doesn’t work either

Yes it does.

If you can’t make it work you’re obviously doing something wrong,

But, as you haven’t shared what you’ve done, no one can tell you what you’ve done wrong.

Maybe share some more details of what you’ve actually done so someone can identify your mistake for you.

I shared some screenshots above…
and here are the new tests

This is the last one

image


This one is what @boston85719 suggested

Custom States (forged filter-body)
image

Step 1:


image

Step 2:


image

Step 3:

Step 4:

I’ve got no idea what any of that is - it’s certainly got nothing to do with anything I’ve suggested, so I can’t really help you with that.

It’s simple to do what you’re trying to do, and I’ve already explained how (I use this exact method regularly, and it works perfectly). but it’s up to you if you want to use it or not.

This was your idea? Or I’m getting it wrong?


image

And it is asking for more and it doesn’t stop

No, I don’t know what that is, or what that’s supposed to to? And it actually doesn’t make any sense at all (it’s certainly not what I suggested).

So, now I’m not too sure what you’re actually trying to do.

I thought you were trying to set a custom state list of options to the list contained in a URL parameter? In which case I’ve already answered how to do that.

But maybe I’ve misunderstood your question?

Maybe I haven’t explained myself well…

I have a list of colors (Option Set) that I have “inserted” in the URL Parameter to retrieve it to the next page

image

In the URL Parameter right now are two options (colors - E zezë, Gri)

image

I want to put this list in a custom state so the Repeating Group can read it and mark as checked the colors

image

Thanks again for answering
Fabian

Yes, that’s exactly what I thought you were trying to do - and exactly what i’ve already answered:

Except you’re not setting the URL parameter the way I said, so it won’t work unless you change the delimiter - i.e , (comma space) . But I’d recommend doing it the same way I did:

Here’s a working example if you still can’t figure it out:

Read Option Set From URL (bubbleapps.io)

1 Like