We are trying to pass a parameter with the App Builder to view a particular row in the database. Right now, when we pass the Row ID parameter, it works fine to find the record. However, instead of a Row ID, we wanted to pass another parameter in the URL that is in the database table (we have a unique key in a separate column). However, the app builder will not look up the field in the database when you pass a different parameter, other than the Row ID. Is this a current limitation? The only param you can pass that will work is the Row ID of the associated record? If not, how do you pass a param that is not a Row ID to have the page look up the record in the associated database based on the passed param? If you can only pass a Row ID, then I suggest adding this a new feature, to allow other Params besides a Row ID to be read from the Param, because very often you have related data in tables and you don’t necessarily have a linked field. In those instance, passing a unique id in the URL, which is NOT a Row ID, would get the record in the table and that is what you would want to pass. Thanks.
Good morning @ddsgad,
However, the app builder will not look up the field in the database when you pass a different parameter, other than the Row ID. Is this a current limitation?
In a “single row” data source, yes this is correct. You can either:
- Add a page parameter which resolves to the row ID, or
- Set a static integer yourself, so you always fetch a specific row ID, or
- Leave the field blank, and we’ll choose the first row in the table for you (which is useful if you’ve sorted the table a specific way).
However, instead of a Row ID, we wanted to pass another parameter in the URL that is in the database table (we have a unique key in a separate column).
Could you make use of our filters for this? Perhaps a combination of:
- Leaving the “Row ID” blank, so we choose the “first” row and
- Adding a filter on that unique key, and passing in the page parameter for that key as a filter value, like so:
So long as 1+2 resolve to a single row, this should work for you.
I hope this helps, have a great day!
Cheers,
Peter Evans
Thank you! Passing parameters via the filters works great. You might want to add that to your docs that you can leave the Row Id empty and just pass a param in the filter. It’s not clear.
That’s great to hear @ddsgad!
You might want to add that to your docs that you can leave the Row Id empty and just pass a param in the filter. It’s not clear.
My apologies, we can work on that. You can find the “missing row ID” mention on this page:
When you select the Get single row service type, you need to enter or map a row ID to retrieve a single row in a given table by its ID. Leave this value empty to return the first row in the table.
Cheers,
Peter Evans
It does not work @picklepete.
I have performed the solution you suggested:
- Data Source with filter that selects the column and the content of the parameter, in this case the UUID (Parameter > :uuid).
- Empty Row ID field (both in Data Source and with Update Row).
However, every time new data is added it appears as a new row, without respecting the filter added with the UUID parameter.
It was checked that:
- The value of :uuid is correct, for example:
4b8c48e3-9cec-4a95-b746-0a7efb76582a
. - The Row ID fields are empty
- The selection of the column containing the UUID is correct.
What am I doing wrong? Thank you very much in advance.
@jrmi how did you get it to work?
Hey @khalil.io ,
Could you share a screenshot of the configuration of the page and the configuration of the filtered data source? It would help us to figure out what’s wrong.
Thanks
Of course it is. I can’t upload more than one attachment, but I put them all together in one image.
I will pass 6 captures:
A) Page 1 (Home):
- Data Source
- Create Row
- On submit > Set parameters (:uuid) to navigate to Page 2
B) Page 2:
- Database Values 2.
- Data Source
- On submit > Empty Row ID
Do you need any more data?
Great thanks. I see in the last screen (6) that you haven’t selected a row ID, what happens if you select the id of the row you get from the data source?
Correct, if in screen 6 I select the Row ID with :id, it works. But it is not what I need, because doing so allows anyone to edit another row just by changing the link. For example, with a link :id/:uuid
= 124/4b8c48e3-9cec-4a95-b746-0a7efb76582a
, if it is changed to 123/4b8c48e3-9cec-4a95-b746-0a7efb76582a
, all data in the row with id 123 (or earlier) is updated or view data it contains regardless of the next uuid. Being a public app, the database is exposed if someone discovers that the id is correlative.
For that reason, I wanted to use the UUID as the “identifier” (I know that currently you can’t change the Row ID value). But from what I read in the post Prefill login form - #4 by jrmi and what @picklepete said, using filters allows the UUID to be correctly mapped and the data sources to be configured to search by this field instead of the Row ID.
Why doesn’t the mapping work, why does it create a new row?
Don’t use the id in the url (and remove this parameter), get the id from the data source as I suggested that way it won’t leak and it’s not possible to change it unless you know the uuid which is really difficult to guess.
You are a master @jrmi! Thanks for the help, it’s the solution. Every day more and more I understand all the logic of Baserow.
Attached is a screenshot of the On submit (Update) > Row ID > Data Source > Data Base > id
configuration: