# Tags in constraints

**URL:** <https://forum.sambapos.com/t/tags-in-constraints/500>\
**Category:** V4 Question\
**Created:** [February 10, 2014, 10:19am UTC](https://forum.sambapos.com/t/tags-in-constraints/500 "2014-02-10T10:19:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrigu3014](https://forum.sambapos.com/user_avatar/forum.sambapos.com/chrigu3014/32/39083_2.png) [@chrigu3014](https://forum.sambapos.com/u/chrigu3014)\
**Post date:** [February 10, 2014, 10:19am UTC](https://forum.sambapos.com/t/tags-in-constraints/500/1 "2014-02-10T10:19:34Z")

</div>

Hi, is there a list of tags (i.e. `{:Tax Template}` or `{:Order Tag}`) that can be used use for building custom constraints?

One more question, I use the ‘Update Order’ action to set a price definition when an order has been tagged, when the order is untagged I would like to remove this price definition again. How can I set a value tu NULL explicitly?

---

<div class="post-metadata">

**Author:** ![JohnS](https://forum.sambapos.com/user_avatar/forum.sambapos.com/johns/32/24916_2.png) [@JohnS](https://forum.sambapos.com/u/JohnS)\
**Post date:** [February 10, 2014, 12:05pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/2 "2014-02-10T12:05:48Z")

</div>

Most if not all Printer Tags can be used in Actions & Rules.  
The best way to test is to create an Action to Display a Message, put this in a rule and use a Printer Tag to display the values you want, then you have an idea of what is available. The general guide is if a Rule deals with Orders, then Printer Tags related to orders are available. If a Rule deals with the Ticket, then Printer Tags for Ticket information is available.

If you are using Update Order to apply discounts, etc, you can use Order.PriceTag to set the Order back to its original price. Have a look at [How to add %50 discount button](http://sambapos.org/wiki/doku.php/en/how_to_add_50_discount_button) and [Adding Discounts to Orders with Order Tags](http://sambapos.org/wiki/doku.php/en/adding_discounts_to_orders_with_order_tags) for some hints.

---

<div class="post-metadata">

**Author:** ![chrigu3014](https://forum.sambapos.com/user_avatar/forum.sambapos.com/chrigu3014/32/39083_2.png) [@chrigu3014](https://forum.sambapos.com/u/chrigu3014)\
**Post date:** [February 10, 2014, 1:22pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/3 "2014-02-10T13:22:52Z")

</div>

Thank you! Second part of my question: is there a special syntax to reset a formerly to an empty value (i.E. reinitialize)?

---

<div class="post-metadata">

**Author:** ![JohnS](https://forum.sambapos.com/user_avatar/forum.sambapos.com/johns/32/24916_2.png) [@JohnS](https://forum.sambapos.com/u/JohnS)\
**Post date:** [February 10, 2014, 1:27pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/4 "2014-02-10T13:27:32Z")

</div>

For Price Definitions, setting the definition again but leaving it blank should reset.

---

<div class="post-metadata">

**Author:** ![chrigu3014](https://forum.sambapos.com/user_avatar/forum.sambapos.com/chrigu3014/32/39083_2.png) [@chrigu3014](https://forum.sambapos.com/u/chrigu3014)\
**Post date:** [February 10, 2014, 1:33pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/5 "2014-02-10T13:33:51Z")

</div>

No it does not, unfortunately it just keeps the one already set.

---

<div class="post-metadata">

**Author:** ![chrigu3014](https://forum.sambapos.com/user_avatar/forum.sambapos.com/chrigu3014/32/39083_2.png) [@chrigu3014](https://forum.sambapos.com/u/chrigu3014)\
**Post date:** [February 10, 2014, 1:36pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/6 "2014-02-10T13:36:41Z")

</div>

John,

how would I express that don’t want an action executed for a certain (or even more than one) product group (see below)?

![](https://forum.sambapos.com/uploads/default/original/3X/4/3/432105e7d54b65a07a4596b83daaf7d64cb40e3e.png)

---

<div class="post-metadata">

**Author:** ![JohnS](https://forum.sambapos.com/user_avatar/forum.sambapos.com/johns/32/24916_2.png) [@JohnS](https://forum.sambapos.com/u/JohnS)\
**Post date:** [February 10, 2014, 1:48pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/7 "2014-02-10T13:48:23Z")

</div>

Are you using Update Order Tag or Change Price List action ?

---

<div class="post-metadata">

**Author:** ![chrigu3014](https://forum.sambapos.com/user_avatar/forum.sambapos.com/chrigu3014/32/39083_2.png) [@chrigu3014](https://forum.sambapos.com/u/chrigu3014)\
**Post date:** [February 10, 2014, 1:49pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/8 "2014-02-10T13:49:23Z")

</div>

Update order action…

---

<div class="post-metadata">

**Author:** ![JohnS](https://forum.sambapos.com/user_avatar/forum.sambapos.com/johns/32/24916_2.png) [@JohnS](https://forum.sambapos.com/u/JohnS)\
**Post date:** [February 10, 2014, 1:50pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/9 "2014-02-10T13:50:25Z")

</div>

For multiple constraints I would use Custom Constraint List and change Execute Rule if Matches All.

Use != instead of \<\>

---

<div class="post-metadata">

**Author:** ![JohnS](https://forum.sambapos.com/user_avatar/forum.sambapos.com/johns/32/24916_2.png) [@JohnS](https://forum.sambapos.com/u/JohnS)\
**Post date:** [February 10, 2014, 1:59pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/10 "2014-02-10T13:59:04Z")

</div>

Try running Update Order action again with the following should reset the order to original price.  
Portion Name = [=Order.PortionName]  
Price Tag = [=Order.PriceTag]

---

<div class="post-metadata">

**Author:** ![chrigu3014](https://forum.sambapos.com/user_avatar/forum.sambapos.com/chrigu3014/32/39083_2.png) [@chrigu3014](https://forum.sambapos.com/u/chrigu3014)\
**Post date:** [February 10, 2014, 4:14pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/11 "2014-02-10T16:14:20Z")

</div>

I can’t get the custom constraint to work. In the Following example the Message always shows up, i.E. the constraint always resolves to true: ![](https://forum.sambapos.com/uploads/default/original/3X/9/6/96745f750bd60eb1f85fb3405e97de2a669d9715.png)

---

<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:** [February 10, 2014, 4:18pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/12 "2014-02-10T16:18:47Z")

</div>

I’m still trying to understand what you are trying to achieve. If you can give more details about your use case we may find better solutions.

---

<div class="post-metadata">

**Author:** ![chrigu3014](https://forum.sambapos.com/user_avatar/forum.sambapos.com/chrigu3014/32/39083_2.png) [@chrigu3014](https://forum.sambapos.com/u/chrigu3014)\
**Post date:** [February 10, 2014, 7:18pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/13 "2014-02-10T19:18:55Z")

</div>

Hi,  
VAT in Switzerland is 8% for articles consumed on premises and 2.5% for take-away articles. This applies to food only, other products such as merchandising are always taxed at 8%. Additionally when a voucher is sold, there is no VAT since a voucher is not a product but a financial transaction. So my POS needs to support the following

- fixed VAT products (8% or no VAT at all)
- variable VAT products (2.5% or 8%)

A customer might buy all of these in one transaction, so I’m restricted to one departement and one ticket type.

Furthermore I want to keep our product list redundancy-free and the menu simple. My Idea was to handle this using an order tag called ‘Take away’. When it get’s set the tax template for this order line will be set using the new setting in the update product action. This works fine when I set the the order tag product by product:

![](https://forum.sambapos.com/uploads/default/original/3X/7/e/7e0b53222a5a5e441b032ebdbe00ed7e9c73d906.png)

Additionally I’ve created a button (the pink one - never mind the color, it’s just for testing) to set all products of an order to take away for easier handling of take away-only orders. Naturally I want to exclude the products which belong to the fixed VAT-categories (products groups ‘Gutschein’ - German for Voucher and ‘Merchandising’) from this rule/action because they are for Take away by nature.

---

<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:** [February 10, 2014, 8:29pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/14 "2014-02-10T20:29:11Z")

</div>

~~Current actions does not support such tagging operations. Now I understand why you were looking for order looper. You need to loop through all orders and execute related actions by order type. Umm… yes that might be an interesting feature but first I have to check if such feature will be possible.~~

It seems you found the right solution by handling “Order Tagged” event. I suggest you to use Order States instead of Order tags. It will better suit your needs. You can handle `Order State Changed` event to check order properties and execute related actions. I used same approach on “Coupon Promotions” tutorial and it worked fine. Feel free to ask when needed.

---

<div class="post-metadata">

**Author:** ![chrigu3014](https://forum.sambapos.com/user_avatar/forum.sambapos.com/chrigu3014/32/39083_2.png) [@chrigu3014](https://forum.sambapos.com/u/chrigu3014)\
**Post date:** [February 11, 2014, 8:27am UTC](https://forum.sambapos.com/t/tags-in-constraints/500/15 "2014-02-11T08:27:51Z")

</div>

Will try! Thanks a lot!

---

<div class="post-metadata">

**Author:** ![chrigu3014](https://forum.sambapos.com/user_avatar/forum.sambapos.com/chrigu3014/32/39083_2.png) [@chrigu3014](https://forum.sambapos.com/u/chrigu3014)\
**Post date:** [February 11, 2014, 11:34am UTC](https://forum.sambapos.com/t/tags-in-constraints/500/16 "2014-02-11T11:34:52Z")

</div>

Hi, using order states does not work either. The problem seems to be that the {GROUP CODE} tags cannot be used in rule constraints when an automation command is executed on all order lines from the ticket screen. It does work when I execute the same automation command from the orders screen after selecting multiple order lines.

---

<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:** [February 11, 2014, 11:43am UTC](https://forum.sambapos.com/t/tags-in-constraints/500/17 "2014-02-11T11:43:56Z")

</div>

OK. Let me test that.

---

<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:** [February 11, 2014, 12:11pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/18 "2014-02-11T12:11:16Z")

</div>

Can you try that?

1. Execute `Update Order State` action with a dummy state set. For example update `LoopControl` state to `Test`.
2. Handle `Order State Changed` event and if:

- `StateName` Equals `LoopControl`
- `State` Equals `Test`
- `{GROUP CODE}` Equals `xyz`,  
… execute your actions to update order’s tax related states.

1. Execute Update Order State action again to Update `LoopControl` state back to null.

You’ll execute 1 and 3 from automation command handling rule and create new rule for 2.

---

<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:** [February 14, 2014, 11:46pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/19 "2014-02-14T23:46:00Z")

</div>

Could you solve it? Let us know your progress.

---

<div class="post-metadata">

**Author:** ![chrigu3014](https://forum.sambapos.com/user_avatar/forum.sambapos.com/chrigu3014/32/39083_2.png) [@chrigu3014](https://forum.sambapos.com/u/chrigu3014)\
**Post date:** [February 15, 2014, 1:19pm UTC](https://forum.sambapos.com/t/tags-in-constraints/500/20 "2014-02-15T13:19:02Z")

</div>

Hi, no I haven’t tried it, I’ve been busy setting up all the hardware for our POS an creating the printer templates. Will get back to the VAT this week end.

Regards  
Chris
