Dine In or Takeaway Help

I’m sorry buddy, I’m unfamiliar with the term “Ternary” and how it works in Samba. ahah >.<

Ok I made the Ticket tag for dine in or takeaway. But how do we use ternary to evaluate and decide what to print? could you show me an example in the work? or possibly guide me on how I could do this?

I just started getting the hang of all of this customization again haha. I’ve been a bit rusty.

Yes sorry had to step out for a bit. When I’m back at a computer I’ll show you. Lots of discussions on ternary operator though just do few searches until I get back.

That’s ok. I’ve tried numerous ways to do this. But I can’t seem to get it right. In a sense, I want Dine In to go to table selection, but I don’t really want Table selection entity screen to be in POS. is there another way around it?

One option would be a [?prompt] but for simplisity you would want numbers to be straight numbers without T or other letters and a numberpad keyboard on your prompt.
The prompt would go in I imagine a change ticket entity action so you would ger a prompt for table with a entry field and a number type keypad.

Although is you dont have an entity grid to select table what was you plan for opening tickets after initial close, ticket lister or are all ticket paid straight away every time.

Here is an example of Ternary Operator expression use in a printer template.

1 Like

@JTRTech Sorry I may not have been so clear. Currently I have 3 entity screens when clicking POS. “DINE IN OR TAKEAWAY”… “ALL TABLES”. “CUSTOMER SEARCH”…

When user Presses POS, they would only see 2 screens, “DINE IN OR TAKE AWAY”… “CUSTOMER SEARCH”… “ALL TABLES” should not be there. However under “DINE IN OR TAKE AWAY” entity screen, there are two buttons. “Dine in” “Take Away”… When they click “Dine In” it will go to table number selection. When selected, if the ticket is paid on spot, then it just goes back to “DIne In or Takeaway” Entity screen… If it’s paid later then I would create a separate entity screen that only shows Open orders, in which user can scroll through.

@Jesse Thanks kendash. I took a look at the post and the ternary script. I can read and understand it, but in this case, how would I be able to do it for something like this?

[=TN(’{TICKET TAG:SG}}’) = Take Away ? ‘{TICKET TAG:SG}}’:"]?
Would I do something like this?

Another way I was thinking was, Implement a ticket tag that toggles between dine in or take away. Then the only thing I would need it to do, would be when Dine in is pressed, the user would input a table number, which would then be printed on their receipt and kitchen order. And if I insert that Ternary into the ticket template then it could select between Dine In or Takeaway.

The only thing I would want it to do then is , when a Table number is inserted, it puts the Table number instead of the ticket number.

IN this case, what would I change in the ternary equation?

Not sure exactly what TN stands for (thinks its Turn to Number or at least thats how I think of it.
What is {TICKET TAG:SG} goig to return?
Also you have two }} after it…
If the tag is Takeaway or Dinein it would be more like;
[= '{TICKET TAG:SG}' == 'Take Away' ? '{TICKET TAG:SG}}' : " ]
Am no pro on this function but definatly want to loose the TN.
Also single = along with > and < only work with numbers.
When working with strings (text) it would be either == or != (equals or not equals).

[=('{TICKET TAG:SG}' == 'Take Away' ? '{TICKET TAG:SG}' : '')]
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   ^^^^^^^^^^^^^^^^^   ^^
         condition to test                    |           |
                              when condition is TRUE      when condition is FALSE
  • When the SG Ticket Tag is equal to Take Away, it will print the contents of the Tag, which will be Take Away.
  • When the SG Ticket Tag is not equal to Take Away, it will print nothiing ('').

JTRTech. Yeah I knew I had a few things wrong. but @QMcKay figured it out on how I should get it to work.
{TICKET TAG:SG} would return either Take Away or Dine in.

@QMcKay So If I did
[=(’{TICKET TAG:SG}’ == ‘Dine In’ ? ‘{TICKET TAG:SG}’ ‘{TICKET TAG:SG}’ == ‘Take Away’ | ‘{TICKET TAG:Order no}’)]

would it say " When the SG Ticket tag is equal to "Dine In, it will print the content of the tag which will be “Dine In”
When SG Ticket does not equal Dine in, it would Print “Take Away” with Ticket Tag content of “Order no”…?

[=('{TICKET TAG:SG}' == 'Dine In' ? '{TICKET TAG:SG}' : '{TICKET TAG:SG}' + '{TICKET TAG:Order no}')]

That assumes you have a Ticket Tag named “Order no”, which IMO does not make much sense.

Well I have another Ticket Tag named Order no. which pretty much puts a generated number which can be reset upon ending work period. This would be the take away number for the customer.

Basically what I want to try and make it do, is when Dine in is selected, it also puts the Dine in Table Number which is a number inserted by the user or the table number becomes the table selected when Dine in is pressed. When take away is pressed, it puts the auto generated number under the ticket tag : Order no.

That’s what I want to really accomplish. Do I make sense?

Also, the last part where it also puts the ticket tag: Order no. in the ticket template, could I make it so that prints on the next line, under the the equation?

No. It will print wherever the expression is located. You can try linebreak characters to move it down…

\r
<linebreak/>
<br/>

The above are line break tags that behave in slightly different ways, and some may not be valid in a printer template, so experiment with them until you get what you want.

[=('{TICKET TAG:SG}' == 'Dine In' ? '{TICKET TAG:SG}' + '{ENTITY NAME:Tables}' : '{TICKET TAG:SG}' + '\r' +  '{TICKET TAG:Order no}')]

Alright sweet. I’ll test this out and update :). Thanks for the help.

Just one more question. Just to clarify, In my custom entity display, Take away and dine in are the buttons.
When dine in is selected, A table number must be picked before it creates ticket. When a table is picked, how could I automate it so that when a table is picked, it automatically inserts the ticket tag as Dine in.

When take away is clicked, it creates a ticket straight away, when this is done, I would want it to put Take away ticket tag as soon as its created.

Use Update Ticket Tag Action in the same Rule.

Another method is use Ticket created event and constrain to tables entity type.

Which rule do you mean? The rule I created for Dine In button simply just goes to the table number selection.

I looked at the possible rules that I could use the update on, but I don’t see any.
I think I might be making this more complicated than it actually is lol.

Hey guys. Finally coming back on track, but thought of a different way. wanted to see if this was possible.

I felt I was making this more complicated than it has to be. I have a feeling that through actions and rules defined by ticket tag type, I could get it to print individual print templates.

I’ve created in Printer Templates
1- Dine In Receipt Template- It will print {ENTITY NAME: Tables}
1- Dine in Kitchen Template- It will print {ENTITY NAME: Tables}
1- Take Away Receipt Template- Prints Ticket number based on {TICKET TAG:Order No}
1- Take Away Kitchen Template- Prints Ticket number based on {TICKET TAG:Order No}

1- Print Job for DINE IN Receipt- Assigned to DINE IN RECEIPTTEMPLATE
1- Print Job for DINE IN Kitchen- Assigned to DINE IN KITCHEN TEMPLATE
1- Print Job for TAKE AWAY Receipt- Assigned to TAKE AWAY RECEIPT TEMPLATE
1- Print Job for TAKE AWAY Kitchen- Assigned to TAKE AWAY KITCHEN TEMPLATE

Now, I’ve setup 2 ticket tags named DINE IN & TAKEAWAY. What I’ve done is, I’ve made it that when TAKEAWAY ticket tag is selected, an ORDER number is automatically assigned.
When DINE IN ticket tag is selected, it doesn’t have ticket tag.

Could I make it so that when DINE IN entity is selected, and ONLY when a TABLE number is selected, it automatically attaches the DINE IN ticket tag.
And when TAKEAWAY is selected, it attaches the TAKEAWAY tag…

Also is there a way through Actions and Rules that when a table number is selected, it automatically prints the DINE IN receipt and kitchen print template. And likewise for TAKEAWAY, it would select the print the TAKEAWAY receipt and kitchen template?

Or is there another less complicated way to implement this?

UPDATE: I did try to use that ternary expression, didn’t work out. I think It had something to do with the way I setup my ticket tags, since then I have deleted the extra ticket tags and just left the DINE IN as a separate ticket tag and TAKEAWAY as another ticket tag that can be pressed.

I’m thinking the process would be similar to how we used ORDER NO ticket tag to automatically assign an order number to the ticket, which auto increments and resets after WP has ended.

You have some good ideas and definitely worth a try. I have some suggestions to make these conversations more constructive and help you get better suggestions faster. When you tell us that you tried something but it doesnt work please show us your work that you tried via screenshot. Often it could be a typo or wrong use of syntax and a second set of eyes can catch it for you.

Always provide detail of what you tried with actual examples otherwise we can only guess at what it might be. If its a simple mistake we may never catch that unless you provide us examples.