Sending an array of things in query parameter

I’ve used query parameters and “Get data from page URL” to send an object ID to another page. I’m wondering if it’s possible to send an array of things to another page, and if so what format do I need to use?

I tried ?things=id,id,id and that didn’t work for me.

My current workaround: I made a data type with a field which is a list of things. Instead of attempting to send a list of things as a parameter, I create an instance of this data type with the list I want and send the unique id for it. Then I get the list of things from it once the page loads.

To avoid creating tons of useless records, I created a database trigger to delete these after 1 day (which technically means if a user tries to reload the page a day later, it will no longer work the same way).

I can’t seem to find a way to turn a list of unique ids into a list of the appropriate THING in Bubble, a problem which rears its ugly head in several different use-cases. There should be a built-in way to do this. And no, you can’t do a search for the things and use “Unique ID is in this list of IDs” because unique ID only supports = or <> operators.

One final workaround I’ve considered: use the list shifter plugin to iterate through the list of texts and search for the correct thing by ID one at a time. Add the results to a list state, and voila.

The separator is comma space (, ) but of course it must be URLencoded, the value of which is %2C%20

Example: Here’s a URL that sends the unique IDs of two Pets to some page:

We uncover how this is done by just doing it:

Are you constructing these URLs in some other environment outside of your app? If this is your own app isn’t it easier to just use “Go to page” than constructing the URLs yourself? (I do of course realize that there are many reasons you might construct your own querystrings – this is more of a rhetorical question.)

You don’t need to do that, obviously.

Another thing you could consider, if you like my plugins: Instead of passing giant URLs around, you could consider just storing that data in browser storage, like with Floppy for example.


Hey @keith, but how do you take that list and turn it into a list of things? I already set up the “Go to page” action like you show in your example, but “Get data from page URL” doesn’t have an option for “Is a list”. It just lets you select what type of data to expect. Since it’s not expecting a list, it doesn’t work. Does that make sense?

Well, that’s stupid now, isn’t it? Even stupider: I was just writing a little plugin for this (dubbed “Rehydrator” cuz that’s what it does) and it turns out that there is a bit of a bug in Bubble’s “:split by” when a URLencoded string is sent to plugins. It seems to URLdecode and then try to split, which is not the behavior in a text element.

Yields in page:

But the plugin gets the URLdecoded string, so you have to split by ", "

But ANYWHO, I built an element plugin for this (please don’t do this with List Shifter Iterate, that’s just so slow). It’s part of my commercial Floppy plugin suite, which is pretty much where all of my new work is going.

By getting that plugin, you’ll have two potential solutions to the problem, Floppy Rehydrator (the new plugin that takes lists of UIDs and rehydrates them back into their real Things), but also Floppy (which would enable you to store these lists in, e.g., sessionStorage or localStorage, instead of passing them via the URL).

Here’s how you use Floppy Rehydrator in your context:

:point_up:select your data type and then pass a list of texts that are the UIDs (you can do this for up to three different types of Thing/texts pairs)

Then your rehydrated Things appear at Rehydrator’s Rehydrated Things 1, 2, or 3 outputs, as appropriate. :point_down:

Now your IDs are things again! :tada::tada:

A couple of additional notes:

  1. The issue you described here, @giosegar, (that you can send arrays of parameters with “Go to page” but cannot read them back with “Get Data from URL”) seems like a bug (or at least a highly suboptimal oversight on Bubble’s part) and you might want to file a bug report/RFE about it. I certainly expected it to just work the way you originally expected!

  2. Note that this plugin, like any element plugin, needs time to initialize and cannot be guaranteed to have read the URL, parsed the input UIDs, recovered the Things and published them to its outputs before Bubble’s “Page Loaded” event has fired. Just like List Shifter, Floppy Rehydrator sends an “Initialized/Updated” event (and sets a boolean for its “Initialized” exposed state) as soon as it has completed its initialization tasks. Before you see that event fire or Initialized go to “yes” you cannot assume that the presence of empty at the plugin outputs means that there were no values in the URL to recover.

  3. The behavior I mentioned whereby :split behaves differently in a plugin input than in a text element may or may not be a bug. It’s possible/likely that any short text input (not just ones in plugins) behaves in the same way. (I’m not going to test it at the moment, but you might be interested in that.)

On #1: It might be a bug, but keep in mind we still can’t use “Go to page” to go to a dynamic page. You have to select it from a dropdown. So if you want to trigger actions with URL parameters in a multi-page app, you’re pretty much stuck making huge workflows with several “Go to page” actions and “Only when page name is” conditions. I’ll give it a shot with Bubble :slight_smile:

On #2: I appreciate that your plugins explicitly expose the initialized state :slight_smile:

Is Rehydrator already part of Floppy or is it coming soon?

1 Like

Hey @giosegar, Rehydrator is already in Floppy (I added it and published an update before my reply explaining how to use it!).

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