Search Field Linking to Dataset on a new page

Hi, I currently have a search field that I am using which then displays the record result in a table, which works great.

However, I want a search field and search button that will navigate to a new page that has a dataset that is linked to the search field. Is this possible?
Alternatively, I will only ever have 1 result in the table I have today, so I was wondering if there is any OnClick code I could add that will then take me to a new page with the details of the record.

I hope that this makes sense? I am open to other ideas, but just want a search function where i can then link to a page with a linked dataset.

Thanks
Dave

Hey
So you want to be able to link from the results to the Dynamic Page of the resulting record? Or do you want the search it self to link to a page and send the search phrase to that page?

Thanks for your response,
I worked a few things out since, but I can’t quite get what I want.

At the moment I have a coded Table that appears showing the results of a search based on 3 fields (Forename, Surname and BookingRef). There will only ever be one result for this search (or no matches), so I want the results to be displayed in the table, but then the user should be able to click on the record and it take them to a Dynamic page via the BookingRef.

I am trying to add a link behind the LinkPath, but cannot find the right format for this, and don’t know if I need a new function for this to work?

Also, if there are zero results from the search, I just want the table to not display and a message appear stating no results found.

Also, if you are also able to help, I am trying to combine the forename and surname fields for display in the table. The below does not seem to work.

Code below so far

import wixData from ‘wix-data’;

$w.onReady( function () {
$w(“#BookingResults”).columns = [
{
“id”: “BookRef”, // ID of the column for code purposes
// The field key in the collection whose data this column displays
“dataPath”: “bookingRef”,
“label”: “Booking Reference”, // The column header
“width”: 100, // Column width
“visible”: true , // Column visibility
“type”: “string”, // Data type for the column
// Path for the column if it contains a link
“linkPath”: “link-field-or-property”
},
{
“id”: “Name”,
“dataPath”: “customerFirstName” + " " + “customerSurname”,
“label”: “Name”,
“width”: 100,
“visible”: true ,
“type”: “String”,
“linkPath”: “link-field-or-property”
} //,
// more column objects here if necessary
// …
// …
];
});

export function Search_click(event, $w) {
// Runs a query on the “Members” collection
wixData.query(‘Bookings’)
// Query the collection for any items whose “Name” field contains
// the value the user entered in the input element
.eq(‘customerFirstName’, $w(‘#Forename’).value)
.eq(‘customerSurname’, $w(‘#Surname’).value)
.eq(‘bookingRef’, $w(‘#InsertRefNo’).value)
.find() // Run the query
.then(res => {
// Set the table data to be the results of the query
$w(‘#BookingResults’).rows = res.items;
});
}