# Tag Enclosed within a Ticket 'Report' Expression in Action Constraint

**URL:** <https://forum.sambapos.com/t/tag-enclosed-within-a-ticket-report-expression-in-action-constraint/9144>\
**Category:** V5 Question\
**Created:** [January 24, 2016, 11:43pm UTC](https://forum.sambapos.com/t/tag-enclosed-within-a-ticket-report-expression-in-action-constraint/9144 "2016-01-24T23:43:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![JTRTech](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jtrtech/32/21270_2.png) [@JTRTech](https://forum.sambapos.com/u/JTRTech)\
**Post date:** [January 24, 2016, 11:43pm UTC](https://forum.sambapos.com/t/tag-enclosed-within-a-ticket-report-expression-in-action-constraint/9144/1 "2016-01-24T23:43:09Z")

</div>

Working on a package (dinner/bed and breakfast system) and woundering if This should work and Im just doing it wrong.  
Have a ticket tag for the number of covers/people in the package.  
Already have courses states for grouping on kitchen prints etc.  
So am using this to calculate if an order should be set to a PACKAGE state from which a order state changed rule makes the appropriate price adjustments.  
This is one of the action constraints;  
`{TICKET ORDER COUNT EXP:(OS.Package=Package) && (OS.Kitchen Course=Starters)} < {TICKET TAG:Package Covers}`

 ![](https://forum.sambapos.com/uploads/default/original/3X/b/f/bfea08bfb58a896c7e83f43870186bca8d27b929.png)  
I was hoping to increase the flexibility of the setup should additional courses be added in the future by using the course itself as part of the TICKET ORDER COUNT.  
What im asking is should something like this work?  
`{TICKET ORDER COUNT EXP:(OS.Package=Package) && (OS.Kitchen Course={ORDER STATE:Kitchen Course})} < {TICKET TAG:Package Covers}`

Specifically this expression;  
`(OS.Kitchen Course={ORDER STATE:Kitchen Course})`  
This is in an order added rule and the {ORDER STATE:Kitchen Course} return the expected ‘Starters’ for the order tested with.

To help understand here is a recording of the process so far;

 ![](https://forum.sambapos.com/uploads/default/original/3X/c/7/c77651275032210ba54fd5781fa29008daf25db4.gif)

Excuse the sluggish recording, hoping its not the number of order added rules :-/  
Also ignore the red ask question, is my test notification of one of the PMS scripts running on trigger…

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [January 25, 2016, 4:15am UTC](https://forum.sambapos.com/t/tag-enclosed-within-a-ticket-report-expression-in-action-constraint/9144/2 "2016-01-25T04:15:22Z")

</div>

You should handle “Kitchen Course state update” instead of “order added”.

---

<div class="post-metadata">

**Author:** ![JTRTech](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jtrtech/32/21270_2.png) [@JTRTech](https://forum.sambapos.com/u/JTRTech)\
**Post date:** [January 25, 2016, 8:11am UTC](https://forum.sambapos.com/t/tag-enclosed-within-a-ticket-report-expression-in-action-constraint/9144/3 "2016-01-25T08:11:40Z")

</div>

If that works would be awesome 😄 am away today so will have to try tomorrow.

---

<div class="post-metadata">

**Author:** ![mjb2000](https://forum.sambapos.com/user_avatar/forum.sambapos.com/mjb2000/32/29209_2.png) [@mjb2000](https://forum.sambapos.com/u/mjb2000)\
**Post date:** [December 10, 2018, 3:37pm UTC](https://forum.sambapos.com/t/tag-enclosed-within-a-ticket-report-expression-in-action-constraint/9144/4 "2018-12-10T15:37:12Z")

</div>

Another blast from the past you were involved in @JTRTech…

I am trying to do something very similar to this…

> [@JTRTech](#):
>
> Specifically this expression;  
> `(OS.Kitchen Course={ORDER STATE:Kitchen Course})`

But I am trying to do it within a rule (Show Message for now)…

I have an Order State called DiverName (multiple divers are often added to one ticket) and when a new order is added I assign the diver name to the order, but when I do this I need to know if/how-many orders that diver already has in the ticket.

If I add diver “Matt” and hard-code the name as below I get the correct result:  
`{TICKET ORDER COUNT EXP:(OS.DiverName=Matt)}`

But, if assign “Matt” and a local settting called “DiverName” and then use the following, I get a result of “-”:  
`{TICKET ORDER COUNT EXP:(OS.DiverName={SETTING:DiverName})}`

Any idea how I can get a count of orders with a particular state, but allow the state we are searching for to be changed programatically?

---

<div class="post-metadata">

**Author:** ![JTRTech](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jtrtech/32/21270_2.png) [@JTRTech](https://forum.sambapos.com/u/JTRTech)\
**Post date:** [December 10, 2018, 4:22pm UTC](https://forum.sambapos.com/t/tag-enclosed-within-a-ticket-report-expression-in-action-constraint/9144/5 "2018-12-10T16:22:16Z")

</div>

Hmmm, not sure, dont think I have ever tried.  
Im guessing its taking {SETTING:DiverName} as the diver name and not parsing the setting value…

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [December 10, 2018, 4:49pm UTC](https://forum.sambapos.com/t/tag-enclosed-within-a-ticket-report-expression-in-action-constraint/9144/6 "2018-12-10T16:49:51Z")

</div>

I’m not sure if nesting is supported in report expressions. Try putting ‘quotes’ around the setting.

---

<div class="post-metadata">

**Author:** ![JTRTech](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jtrtech/32/21270_2.png) [@JTRTech](https://forum.sambapos.com/u/JTRTech)\
**Post date:** [December 10, 2018, 4:51pm UTC](https://forum.sambapos.com/t/tag-enclosed-within-a-ticket-report-expression-in-action-constraint/9144/7 "2018-12-10T16:51:59Z")

</div>

I was going to suggest trying quotes.  
Im sure I might have used [:CommandValue] before in a report expression.

---

<div class="post-metadata">

**Author:** ![JTRTech](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jtrtech/32/21270_2.png) [@JTRTech](https://forum.sambapos.com/u/JTRTech)\
**Post date:** [December 10, 2018, 4:52pm UTC](https://forum.sambapos.com/t/tag-enclosed-within-a-ticket-report-expression-in-action-constraint/9144/8 "2018-12-10T16:52:55Z")

</div>

Sorry, no it was into a script call.

---

<div class="post-metadata">

**Author:** ![mjb2000](https://forum.sambapos.com/user_avatar/forum.sambapos.com/mjb2000/32/29209_2.png) [@mjb2000](https://forum.sambapos.com/u/mjb2000)\
**Post date:** [December 11, 2018, 12:15am UTC](https://forum.sambapos.com/t/tag-enclosed-within-a-ticket-report-expression-in-action-constraint/9144/9 "2018-12-11T00:15:51Z")

</div>

> [@JTRTech](#):
>
> I might have used [:CommandValue] before in a report expression

This gave me the idea of using a square bracket style value instead of a curly bracket… By chaining on to the “Order State Updated” hook I was able to use [:State] and that worked perfectly 🙂
