Ticket Id from Ticket Number - What am I missing

Trying to get ticket ID for a load ticket action is a clean tidy report but cant get it right.
Ticket ID 1058 is ticket number 14…

Tried;
{REPORT TICKET DETAILS:T.Id:(T.TicketNumber=14)}
{REPORT TICKET DETAILS:T.Id:T.TicketNumber=14}
and a few others but cant get it to work.

Where are you using that? What event?

Currently testing in reports template but will be on numberpad entered from scanning barcode of ticket number on receipt.

So why not just put Ticket Id on receipt Barcode instead?

Because ticket id not available untill ticket closing :slight_smile:

Or ticket save. So your printing before close?

And on print bill?? :-/

Could put save ticket action just before the print command in that rule.

is save same as submit? will it send to kitchen?

No worries, will use a script :slight_smile:

function getTicketId(inputTicketNumber) {
	var ticketIdQry = "SELECT [Id] FROM [Tickets] WHERE [TicketNumber] = '"+inputTicketNumber+"'";
	var ticketIdLookup = sql.Query(ticketIdQry).First;
	return ticketIdLookup;
}

No its not. It does write to database but its not triggering the rules that sent to kitchen.

1 Like

So cancel still works?

No it would not. Its hard to tell what your doing. So your printing tickets… but you might cancel an order even if its printed? Wouldnt you only want to print for submitted?

Its for a system for claiming unused loyalty points, there will be a barcode on the receipt and using ticket id obviously gives an error on printing if not saved/submitted and didnt want to create a second template.