Button on a dynamic page, leading to another dynamic page

Question:
I have a dynamic page with a dynamic dataset connected to a database called “Reservations”. One of the fields of this dataset is called “itinerary” and contains the ID (_id) of one of the entries in another database called “Itineraries”. This Itineraries database also has a Dynamic page.

On the Reservations Dynamic Page I would like to create a button that links to the Itineraries Database page, and specifically to the Itineraries page that corresponds with the _id in the “Itinerary” field in the Reservations Database.

I created a dataset connected to the Itineraries Database (dataset2) and that sets to submit and open the dynamic itineraries page. With help of the below code I tried to filter the dataset2 to only select the itinerary that has the ID in the reservations database but it doesn’t work.

	$w("#dataset2").onReady(()=>{
		const itineraryid = $w("#dataset2").getCurrentItem()._id;		
		$w("#dynamicDataset").setFilter(wixData.filter().eq("itinerary",itineraryid));
	});

Anyone any idea how I can achieve what I’d like to achieve?

Thanks a lot!

Product:
Wix Studio

What’s the data in the itinerary column. Is it just a string or a reference field or something else?

Hi! It’s just a string :slight_smile:

You can use a single reference field and connect the button to the link through the editor.

1 Like

That’s what I tried but the _id field is not available in the editor so I think coding is the only way to achieve this.

What doyou mean _id field is not available in the editor does not appear.
If you used a single reference field there should be access into the fields of the item