Get Parameter Data from URL - Search Box & Dropdown

@JP29 To convert the text Get min from page URL into a number for the search constraint, there is no function provided by Bubble. Current workarounds are:

  1. Using an input field as a converter:
    Setting a state (as number, not text) from a URL parameter
    or
    Generate random string only text type

  2. Send the text out through an API to math.js and receive it back as a number. Downside is a delay waiting for the result, not great when populating a default value.

For your default value, you don’t need to convert the URL parameter to number, if you instead convert the Price field to a text for the constraint. This can be done by moving the constraint out from the search and into a filter on the search:

Search for Price Lists:filter:first item's Price

And in the filter: Advanced: This Price List's Price:formatted as 1029 is get min from page URL

One downside to this is if the price list has a large number of rows, a filter constraint is slower than a search constraint.

It is worth considering what you want the default to be, if the URL parameter is empty, or if it doesn’t match any of the prices. Enhancing the filter can help there too.

2 Likes