I want to be able to add a servers Thai name to the kitchen order but use the English name elsewhere. The names are variable lengths so SUBSTR is not going to work so I’ve entered the name in the format English Name - ThaiName and created a script to split the parts at the hyphen
The handler for this script is @@ThaiName and it gives the desired result when @@ThaiName is used in a report, but if I use this in a printer template it simply prints @@ThaiName rather than what I want.
I think I need to create some Update Program Settings actions to temporarily modify {:USER NAME} to the output of @@ThaiName then back to the original once the order is printed. Unfortunately, I can’t see how to implement this.
Can anybody offer some guidance or suggest alternative / better ways to achieve the objective?
You mean order name? Why not just use custom product tags as suggested elsewhere on forum?
Or am I missing what your doing?
Or do you mean the user who added the order?
Maybe explain a little more.
Show how you want this to show on print and your template as it is where it shows @@
No, its the user name I need, i.e. the person placing the order. I am using order tags to create the product names in Thai but I also want the servers Thai name on the kitchen Ticket
The ticket currently prints as
But where it says Test 2 i want the name in Thai (I use English elsewhere so we cant simply enter the user name in Thai.
So you dont call scripts that way. You use CALL:X tag. the @@ was for custom report syntax. HOwever you dont need to do that at all you can use the REPORT SQL DETAILS tag and you dont need a script.
If you making user names with a dash which is what it looks like in your script you can probably get away with just a helper script on {USERNAME} to parse/split.
One other thing which is why I was confused. You SQL script was selecting from orders table for created user. In theory a ticket can contain orders created by multiple users.
Your template suggests your actually looking for ticket user rather than order line user. That’s why I asked about template etc
If not a helper a script where the call inputs the raw username and returned split Thai value rather than querying database since you already have username in ticket info.
Also not sure if that script would work anyway as your call is in ticket layout section and like said your selecting from orders table with id so not sure how your intending to link ticket to order id without join or using ticket id column of orders table.
Agreed a ticket can be created by multiple users, but by selecting the latest order, i.e. the one being printed it should capture the sever actually placing the order. SELECT max(Id) FROM orders should be the order being printed.
The main reason I did it that way was simply that I wasn’t sure how to bring {USERNAME} into the script.
Can you expand on what you mean by 'a helper script on {USERNAME} ’
You could try {CURRENTUSER} or it might need a colon {:CURRENTUSER} - would need to check on that.
I would need to do a bit of digging to find a helper, or someone might know of hand, know there is a slice one but would definitely be easy in a call to jscript inputting username or current user as a variable, would be a simple split and return first or second part depending on your username setup. Iwouldn’t bother qry database when data is already to hand.