Can't seem to get data from page URL

Id like to get the unique id from the URL, how would I do that with “Get data from URL” what would be the parameter? Right now I have “unique id = Get id from page URL” but it doesn’t seem to work, In the data source area I have “Search for Listings: first item” and every listing pops up as first item. So either the search isn’t working or I am doing something else wrong.

If anybody can take a look I would be very grateful.

2 Likes

Hey, I’m stuck into the same problem. Did you realize how to cope it? I’ll be grateful for any help!

Could you share more about the issue that you’re running into? Perhaps a few screenshots.

Remember that parameters are for passing data points from one page to another page using a key = value. So, on page A, you have a “Go to page” action and add parameters. Then, when you navigate to page B, you make use of those parameters. Typically with a parameter, you should be having to perform a "Search for [thing], because you’ve passed a concrete value (ie. the unique ID of a specific thing).

When you look at your URL on page B, after having navigated from page A, you should expect to see the parameter in the url, ex. thing=12345x67890. If not, you may not be properly passing the value.

The key value you specify is case sensitive. So, “thing” is different from “Thing”.

55%20PM

Thank you @dan1 for your answer. I’ll try to explain the problem now.

I’m creating the something like airbnb and I need to set unique profiles for people and for selling items. Lets start with people. Everytime user signs up or item created, it automatically generates the random string (done via Blockspring). I created a group with user info and here is what I did to set parameters


But the group doesn’t show the user. It even doesn’t change the URL of the page

However, when I send the parameter through the link it creates the new link, but does not change the user (this URL I typed myself without using the link, the other user owns thhis ID)

Then even when I enter another profile and try to reach this page through the ugh link, it changes the URL but not the user on the page

The same thing with selling items. Unique page of every item shows only one data and doesn’t change even if URL is changed. What am I doing wrong?

1 Like

Here is the settings of the link by the way

I’m on the road, so I’ll give a quick response.

With parameters, there are two key concepts: sending parameters and getting parameters.

  • Sending parameters is the action where you either update the current page’s URL or you navigate to a new page. You can only initiate this from the Workflows tab.
  • Getting parameters is where you pull a value from the current page’s URL in order to inform something on the page (searching for a value, helping provide context for setting states, etc). As well, you can use this as part of workflows.

I have a quick tutorial covering how to set up a parameter. Here’s the link. Give it a quick look. The current way you’re creating your parameter (via Link destination: external URL) is one way of doing it, but isn’t the recommended way. Rather, use Bubble’s built in function to navigate within the app.

Keep in mind, with parameters, they should be exact matches. From your first screenshot, it says, "Get [object Object] from page URL. If the parameter you’re trying to pull is “id”, that’s what you want to set it up for, not object Object.

One last thing: Bubble has a function for generating a random string (via calculate formula). Using that will generate a sufficiently random string so that you don’t have to utilize Blockspring.

2 Likes

@dan1 Thank you, it’s working!

For the future, can I somehow get rid of this annoying 1234567x7654321 and leave only IDs?

When you start building an app in Bubble, you’re somewhat nudged into setting a data type for pages. This is what forces a unique ID (the current pages thing) to be displayed in the URL directly filllowing the page name.

When building, I strongly recommend against setting a data type at a page level. If you have a solidly constructed user-centered database model and effectively use parameters, rarely should you ever have the need to set a page’s type.

As for your actual parameters, you can choose to use the unique ID, which makes it easier to access the actual thing in your database, or you can use an abstraction (Ie you create your own unique ID and save it with that database item. In the latter case: something like a 7 digit alphanumeric code, which you then apply the search logic of finding the single record where that custom unique ID matches. Similar in concept to what you were trying to achieve originally).

1 Like

Got it. Thank you again!

1 Like

Hi @dan1 , why do you recommend against using Bubble’s data type for pages?

@julian5, Dan hasn’t been active in the forum for over 3 years, so he’s probably not going to answer your question. That being said, I can take a pretty educated guess that the reason he was strongly against setting a type of content at the page level is because when you do that, you are required to send data of the same type to the page every time you navigate to it. There is a workaround where the data you send to the page is a search that doesn’t return an item, but if you find yourself needing to use that workaround, you should probably question why are setting a type of content on the page in the first place. For what it’s worth, I pretty much never set a type of content on a page, and it has never tripped me up.

1 Like

Thanks for the reply, @mikeloc

I’m always curious about design patterns that people use with Bubble.

In my case, I prefer to use page content types because:

  • It forces workflows and links that navigate to the page to send correct data, thus reducing the chance of bugs (I didn’t know about that empty search workaround). To me, this is a good thing.
  • You can reference Page’s type anywhere in the page and workflows (this is convenient and predictable)
  • I assume it’s the fastest way to load data on a page on load, since every other way requires at least one more step (do a search for…)
  • You get that cool automatic conversion to slug in the URL when you specific the unique ID

It doesn’t make sense on every page, obviously. I’m more interested in the downsides that I might be missing.

Since you come from a software dev background (me too), I’m going to check out your other posts! Thanks again for your reply.

1 Like