Create dynamic hyperlink in a table

Hi,

I am creating a directory listing app and am using MySQL as the datasource.

I have a page that runs a query against 2 tables using a join to display

Customer, Vehicle, Date Hired.

John Brown, Toyota Sienna, 1-Jul-2024
Jane Hadley, Nissan Leaf, 3-Jul-2024

What I would like to do is to create dynamic hyperlinks associated with each of these results, so if I click on customer’s name, I go to a page which will run a query on that customer id and display the data. Same for the vehicle.

Thanks
Steve

Hi @SynopsisLabs You can use our listing block (to display customers) and then once they click on that row, you can create a record details page which includes all of that customers data and showcase it there. This is all native functionality.

If that doesn’t work for some reason, you can look at pre-assembling URLs in your SQL database which you then use to trigger on page navigation to go to those pre-made URLs with your users data.

The first option should be good for you though!

Hi,

The first option might not work as I want to be able to go to different pages depending on which column in the row is selected. So if the user clicks John Brown, his details are shown. If they click Toyota Sienna, those details are shown, etc.

Would need some guidance on the pre-assembly. As I mentioned, the links have to be dynamic depending on the id of the data, so for example if I was using php it would be

John Brown, Toyota Sienna, 1-Jul-2024

<a href="customer.php?cust_id=$custId">John Brown</a>,
<a href="vehicle.php?v_id=$vId">Toyota Sienna</a>, 1-Jul-2024

Is this possible?

Thanks
Steve

Instead of this, can you use a listing block with multiple buttons, each button going to the different record detail page?

Ok, I have added a list block but cannot see how to make each cell a button with a link

When clicking on the detail block, click on “action” and create “item buttons”, one button for each record. Then, when you click the button, have it navigate to the proper details page for each record.

When I add a button it creates it for the row. Not seeing how I can create it for each cell.

@SynopsisLabs can you share a visual image where you need the button ?

with SQL joins currently to click a button and open a detail page one way is to create a extra column in the query via CONCAT function like this

SELECT A, B, C, 
  CONCAT('https://mydomain.com/myproject-details-page?recordId=', project_id) as  project_url
FROM ...
JOIN ...
WHERE ...

then you use action button with open external URL and put the project_url

Ok, this is what I am trying to achieve below -

So I don’t need a button which would be an additional component - I want each cell to be a hyperlink to another table passing either customerId, vehicleId or some other identifier.

It also means that the query for the called table must be able to accept the id that is passed.

Hope that this is clear.

I’m still not following I will DM my calendly so we can talk next week and figure it out

1 Like

@SynopsisLabs {RECORD_ID} placeholder is ready for you to test

Thanks. How do I get the formula function in the content field? All I see are the fields from the database or query.

Hi Artur @artur . How do we use this {RECORD_ID} placeholder and can you please kindly explain some use case for it?

hey folks,

I guess you don’t need to use a placeholder anymore… see if this helps 18.09.2024_14.57.18_REC

Thanks,

That’s fantastic and potentially solve some use case that I have

Given your example, if you wanted to be able to click on the order date to show all orders from that date, or on the price to show all products with that price, how would you accomplish that?

Steve