Custom State List Add List

Seems obvious, but…if we are provided the options to set the value of a custom state list with three choices

  1. plus item
  2. minus item
  3. minus list

It would make complete sense to have a fourth choice

  1. plus list

Why is this not already part of the options for how to set the value of a custom state list?

Or am I missing something and there is a way to set the value of a custom state list using a list?

3 Likes

This may be of use mate: https://www.youtube.com/watch?time_continue=3&v=ImJausGZLs4&feature=emb_title

1 Like

Thanks for that link. Unfortunately for my use case that is not a workable method.

What I am trying to do is set up a search page to pass a list of items into a parameter. Obviously parameters currently do not accept lists, so what I am needing to do is create a custom state that is a list of texts and pass that complete list to the parameter.

One issue I have is that my filters on the page are option sets. So in my option set I have the display attribute as well as a filter attribute that basically is lowercase text with slugs if necessary ( for example: strawberry, strawberry-bannana, apple )

The main issue is that when the page is loaded with parameters already in the URL because of back navigation in the browser or perhaps URL is navigated to directly with parameters, the custom state that holds this list of values to pass as a parameter is not able to be set because of this inability to ‘add a list’

The list of option set filters (text) is unknown and not the complete list of possible values from the original list of option set filters, so I am unable to use the method outlined in the video.

I am in the process of attempting to backward implement a system because another drawback of bubble’s implementation does not allow for a filter of a list using ‘is in’ and we are only allowed to filter a list using ‘is not in’

Screen Shot 2020-08-21 at 2.35.44 PM

and because of this little nuance I have to set a list that holds the complete value of my filter option set used to filter ‘is not in’, have a second list to populate based on selections made and a third custom state to store the option set value itself…because the custom state used to filter my search needs to be the actual option set values as that is what is stored on my data type, but I can’t figure how to send the parameter as an option set value.

1 Like

Sounds like a head-scratching, head-banging exercise @boston85719, something I tend to stray away from. If I can’t ‘do-it’ in 10mins I drop it, but then again I am a lazy thinker. I’m sure someone will be able to provide more clarity for you.

1 Like

I’m unclear on the exact problem you’re having. Is it:
(a) Setting a custom state as a list?
(b) Passing a custom state as a list to another page?

It is kind of both.

B. When I am selecting my option set choices for filtering, I am sending the option sets ‘filter’ attribute to the URL parameter as a list joined with ‘/’ so that it looks like a list in a URL

So on my search pages workflows I set the custom state which holds the list of options and then use navigate to set the parameter

Screen Shot 2020-08-21 at 5.20.28 PM

This all works fine and there are no issues with the parameter getting set and no issue with the custom state getting set.

Screen Shot 2020-08-21 at 5.22.40 PM Screen Shot 2020-08-21 at 5.22.34 PM

The problem comes from having the ability for the page on load to set the custom state value as a list by reading the URL parameter.

I was trying to take the URL parameter and translate that into a list of texts, however I am not getting a list of texts, instead I am just getting one text that has a ‘/’ separating the values as they are in the URL parameter itself.

I’m trying to allow a user to open a page using a URL with a parameter (as a list) so that the search results can accept that list to filter the results by.

It is all simple when using only a single value in the parameter or using paths as list…the problem is it seems impossible to set a parameter as a list and have it recognized on page load as a list and it is impossible to use navigate to a page to set the paths as a list

Have you tried using an environmental variable instead of passing as URL parameter?

Is this from the BDK plugin?

My assumption with this plugin is that it would not be set if the user is navigating to the page using a URL.

For example, I search and filter a page and then I copy paste that URL to share with a friend, I don’t think the shared URL would have the search filters set unless my search page is using the URL parameters to set the filters.

If I have the environmental variable set up to do the filtering could I share that URL and have the search filters set?

Ah, I see. Sorry the env variable is not sharable with another user.

The other workaround I can think of is to save the entries in a temp table, and pass that.

@SerPounce @nomorecode thanks for the input on this…I got something figured out that is working well. I put up a tip post to help others who want to use a parameter as a list as well as save it as a search

4 Likes

I will try it ! :ok_hand:

Thanks for taking the time to write it and sharing it with the community.

Small follow up for anyone stumbling on this thread: You could also set the state as (master conditional list) :merged with (list of additions to make)

1 Like

This was more focused on trying to get a list to be a URL parameter value and first attempt was to take a custom state list and send it to the URL parameter. But if trying to just add two lists together in a custom state in which the custom state already has values you can merge two lists as you mentioned so long as both are of same type. Generally the ‘list of additions to make’ would come from some source such as a repeating group potentially.

Screen Shot 2022-02-23 at 9.30.30 AM

Not sure if that would remove any duplicates that may exist when merging though.

2 Likes

Depends on the setup of the database (vs. Option Set), but unique values are generally NOT duplicated in a merge list.