Memo
November 29, 2021, 2:16am
1
For a ticket-listing entity screen I only want to show tags/states when they’re set.
For example:
[<br/>{TICKET TAG:Customer Name}]
[<br/>{TICKET TAG:Order #}]
[<br/>{TICKET STATE:Channel}]
Even though all are set, only “Order #” shows. When I test print each separately only “Order #” shows.
If I strip everything out and leave just the brackets, then everything prints just fine. e.g.:
{TICKET TAG:Customer Name}
{TICKET TAG:Order #}
{TICKET STATE:Channel}
What am I missing here? Or should I be using a ternary expression?
TIA
Posflow
November 29, 2021, 2:26am
2
I made my ticket lister long time ago so I cant exactly remember what was the issue but I think it didnt format properly unless I had <J>
or <L>
before the line.
${TOTAL AMOUNT}<br/>
<L><size 12><block 10>
{ORDERS}
<L></block></size>
[ORDERS]
<J> [=('{QUANTITY}x' + " ").substring(0, 4)] {NAME}|${TOTAL AMOUNT}<br/>
If you can post some screenshots, might help me visualize what your issue is
2 Likes
Jesse
November 29, 2021, 3:06am
3
You need to include the formatting too. <L00>
Memo
November 29, 2021, 4:09am
4
here’s an abridged version of template:
<J><block 1,0,0,0 #5ffffff center 200><color red>{TICKET NO}</color></block>
<J><block 1,0,0,0 #5ffffff left 215><color #2D89EF><br/>{TICKET TAG:Customer Name}<br/>{TICKET TAG:Order #}<br/>{TICKET STATE:Channel}</color></block>
<J><block 1,0,0,0 #5ffffff left 215><color #2D89EF>[<br/>{TICKET TAG:Customer Name}][<br/>{TICKET TAG:Order #}][<br/>{TICKET STATE:Channel}]</color></block>
<L><size 10><block>
{ORDERS}
<L></block></size>
<J><block 1,0,0,0 #5ffffff center 110><color #FFF79646>{TICKET QUANTITY SUM} </color></block>
<J><block 1,0,0,0 #5ffffff center 200><color #85bb65>{TICKET TOTAL} </color></block>
[ORDERS]
<J> {QUANTITY}x {NAME}|{TOTAL AMOUNT}<br/>
Line one displays no problem. Line two shows only the order # ticket tag.
Left side is just with just {}
and to the right is the expression [{}]
Posflow
November 29, 2021, 4:17am
5
Memo:
<br/>
I am thinking the expression might be escaping itself because of <br/>
or doing some crazy stuff like attempting to divide.
Memo
November 29, 2021, 4:24am
6
works in one instance, but not another - it’s strange
<br/>
taken out of expressions and same ol’ same ol’
I really don’t like loading up expressions to evaluate in the ticket lister because of the overhead so I’d really like to avoid a ternary expression.
<J><block 1,0,0,0 #5ffffff center 200><color red>{TICKET NO}</color></block>
<J><block 1,0,0,0 #5ffffff left 215><color #2D89EF>{TICKET TAG:Customer Name}<br/>{TICKET TAG:Order #}<br/>{TICKET STATE:Channel}</color></block>
<J><block 1,0,0,0 #5ffffff left 215><color #2D89EF>[{TICKET TAG:Customer Name}] <br/> [{TICKET TAG:Order #}] <br/> [{TICKET STATE:Channel}]</color></block>
to further illustrate the issue:
Memo
November 29, 2021, 4:32am
7
okay, now looking at that last screenshot it’s a type issue: numbers work, text doesn’t
Is there a different way to handle this type of expression with a string?
updated channel to an integer and bam, works
Posflow
November 29, 2021, 4:34am
8
But why is it important for you to have square brackets around your tags?
Sorry, I probably dont understand what would they do differently on ticket lister because its been a while since I worked on them
Memo
November 29, 2021, 5:17am
9
The brackets, as I understand them, and when used a certain way, will only print the data inside the brackets if it exists. It’s a way to add a line to a (ticket) template with the formatting inside and if the expression is null or empty nothing gets printed.
There are two different scenarios with two different types of data:
pickup by customer or delivery by restaurant which the lister displays customer name and phone number
delivery by third party in which case the ticket lister needs to show customer’s name, order number, and third-party service name (channel)
Data in each scenario does not exist in the other. So I’d like to mash everything into one line so there are no blank lines when displayed if some data isn’t present for that ticket.
After trolling the site, for strings if I use [='{TICKET STATE:Channel}']
then things print just fine. I figure I’ll enclose all that way just to be safe in case there’s an alphanumeric order number at some point.
1 Like
ilyas
November 29, 2021, 5:29am
10
[='{TICKET TAG:Customer Name}'!=''?'<L00>{TICKET TAG:Customer Name}':'']
[='{TICKET TAG:Order #}'!=''?'<L00>{TICKET TAG:Order #}':'']
[='{TICKET STATE:Channel}'!=''?'<L00>{TICKET STATE:Channel}':'']
Memo
November 29, 2021, 5:31am
11
I already have something like that for one part
<J><block 1,0,0,0 #5ffffff left 215><color #2D89EF>[=('{ENTITY DATA:Customers:Name}' == '' ? '{ENTITY NAME:Customers}' : '{ENTITY DATA:Customers:Name}<br/>{ENTITY NAME:Customers}')]</color></block>
the issue is ternary expressions are more costly and with a lot of tickets there can be quite the lag on refresh
Jesse
November 29, 2021, 5:54am
12
For the strings try surrounding it like this [<L00>1: [{TICKET TAG:Customer Name}]]
Memo
November 29, 2021, 6:07am
13
the double set of brackets work, too
thanks!
2 Likes
Posflow
November 29, 2021, 7:52am
14
Thanks for clarifying that though! I now also know how to solve my “new row and empty line” issue when the entity isnt selected
2 Likes