Dynamic Wix Page with Dataset Collection

Hi, I am building a website on Wix with two dynamic pages. Page 1: https://www.thecaninecompany .in/recipes
This page links to a dataset and uses a repeater to show those items.
Page 2:
https://www.thecaninecompany .in/recipes/chocolate-chip-cookies
This page is loaded when an item is clicked on Page 1. I have used a prebuilt preset on Wix to create these two pages.

I am having couple of issues in building the page 2. I will write the problems here one by one.

When loading page 2, I see this error in the developer console:

Failed to perform query on [Recipes].
WDE0045: Invalid .gt parameter value [Undefined]. Valid .gt parameter types are String, Number or Date.

Any idea what is this?

Now on page 2, on load, the #radioGroup2 radio loads its items based on one of the column of the dataset. The column contains an array of values and I parse those array and store it in the radio button. I am currently using this code to do so:

export function loadWeight(){
	let weight;
	wixData.query("Recipes")
		.eq("title", $w("#title").text)
		.find()
		.then( (results) => {
			if(results.items.length > 0) {
				let firstItem = results.items[0];
				weight = firstItem['weight'];
				$w('#radioGroup1').options = buildOptions(weight);
			} else {
				// handle case where no matching items found
				console.log("Item Found", "Zero");
			}
		} )
		.catch( (err) => {
			let errorMsg = err;
			console.log("Error", err);
		} );
}

Here I am using $w(“#title”).text to query on the item being displayed. I am not sure how to get the name from the URL. Please help me understand this.

Also, during preview, the weights are loaded correctly. But when using the live web page, nothing happens. The weights are not being loaded.

Thank you for your support.

Hey there, tackling this 1 by 1.

1. Query/Filter Issue
That issue means that you had tried to use the .gt (that is the greater than) function on your filter with a value that was non-existent, or undefined as the error shares. I don’t see any calls using gt to your query, so I’m guessing it’s in another part of your code. You can use this to

console.log($w("#title").text);

to see what the value of the text is.

  1. Getting The Current Item
    Since you’re using a prebuilt dynamic page to get the item, you can use the following code $w(“#dynamicDataset”).getCurrentItem() to get the whole database record for the page you’re currently on (in this case Chocolate Chip Cookies).

This is ideal, because you will not need the query at all.

//... Get item
exportfunctionloadWeight(){
const currentItem = $w("#dynamicDataset").getCurrentItem()
//Save yourself allllll that extra code and a database lookup
$w('#radioGroup1').options =buildOptions(currentItem.weight)
}

With all those savings you can hopefully invest in some Wix stock or something :slightly_smiling_face:

Hope that this helps. If anything, I can follow up afterwards.

Hi, thank you for your reply. This fixed the issue.

Also, any idea how can I achieve this thing: Whenever a data is inserted in the Dataset, I want an email to be sent to me notifying that a new data has arrived and maybe include those datas in the email. I have found an article: https://support.wix.com/en/article/velo-tutorial-sending-an-email-on-form-submission?_gl=11p4do5b_ga*MTc0OTUzODk0My4xNjMzNzE3MjA2

It require SendGrid. Is there any way to use the Wix’s default ordering email. The form above is for ordering special items since we needed some customisation that wix’s defaul purchasing page and order flow doesn’t yet support.

Thank you!