Help with SQL to create a price check button


its Not showing anything in the test.

Yes, you put your test function in it and click test…

No… like i said…;

Replacing BARCODEHERE with a valid barcode

Deffo works i copied and pasted exactly what @JTRTech did and it worked first time, you must have a typo somewhere

OK, so a typo.
C&P your code - dont forget the script button to sprevent stripping by forum.

I didn’t really understand what are you saying?

When you paste code on forum you should highlight and click this button to post as code as forum can strip some parts.

image

And which code do I have to paste?

The script…
We cant see it all because it off to the side.
Start by taking the ; semicolon of the last line, dont think its needed on the last line.

function checkPrice(inputBarcode) {
	qry =  "SELECT p.[Price] FROM [MenuItemPrices] p LEFT JOIN [MenuItemPortions] s ON s.[Id] = p.[MenuItemPortionId] LEFT JOIN [MenuItems] m ON m.[Id] = s.[MenuItemId] WHERE m.[Barcode]="+inputBarcode+"AND s.[Name]='Normal'";
	var salesTicketCount = sql.Query(qry).First;
	return salesTicketCount;
}

Thats quote rather than code but hay ho.

function checkPrice(inputBarcode) {
qry = “SELECT p.[Price] FROM [MenuItemPrices] p LEFT JOIN [MenuItemPortions] s ON s.[Id] = p.[MenuItemPortionId] LEFT JOIN [MenuItems] m ON m.[Id] = s.[MenuItemId] WHERE m.[Barcode]=”+inputBarcode+“AND s.[Name]=‘Normal’”;
var salesTicketCount = sql.Query(qry).First;
return salesTicketCount
}
function checkPrice(inputBarcode) {
qry =  "SELECT p.[Price] FROM [MenuItemPrices] p LEFT JOIN [MenuItemPortions] s ON s.[Id] = p.[MenuItemPortionId] LEFT JOIN [MenuItems] m ON m.[Id] = s.[MenuItemId] WHERE m.[Barcode]="+inputBarcode+"AND s.[Name]='Normal'";
var salesTicketCount = sql.Query(qry).First;
return salesTicketCount;

}

Again;

function checkPrice(inputBarcode) {
qry = “SELECT p.[Price] FROM [MenuItemPrices] p LEFT JOIN [MenuItemPortions] s ON s.[Id] = p.[MenuItemPortionId] LEFT JOIN [MenuItems] m ON m.[Id] = s.[MenuItemId] WHERE m.[Barcode]=”+inputBarcode+“AND s.[Name]=‘Normal’”;
var salesTicketCount = sql.Query(qry).First;
return salesTicketCount
}

function checkPrice(inputBarcode) {

qry = “SELECT p.[Price] FROM [MenuItemPrices] p LEFT JOIN [MenuItemPortions] s ON s.[Id] = p.[MenuItemPortionId] LEFT JOIN [MenuItems] m ON m.[Id] = s.[MenuItemId] WHERE m.[Barcode]=”+inputBarcode+“AND s.[Name]=‘Normal’”;
var salesTicketCount = sql.Query(qry).First;
return salesTicketCount
}

where is the problem?

What does it say on script test?

I don’t understand what you people trying to say?
Where is the problem?
The script you post on the forum I did exactly copy and paste.