What's wrong with this comparison in constraint? '{TICKET TAG:ORDER}'==''

I can’t figure out why this comparison doesn’t work in constraint field.

This rule is called from Ticket Lister Widget (kitchen display), which opens settled ticket, update a ticket state and then close the ticket.

I want to add a new action to this rule which is restricted by this constraint, which this action will only get executed when this TICKET TAG:ORDER exists.

I’m using this expression in the action constraint
so a message is displayed when TICKET TAG:ORDER has a value.

For this particular ticket, the TICKET TAG:ORDER value is 47, which the expression above should test to TRUE and the action executed.

However in my case I think it test to FALSE, and strangely when I change the condition to ‘{TICKET TAG:ORDER}’ == ‘’ , the action gets executed.

I also tried this condition for the same ticket
‘{TICKET TAG:ORDER}’ == ‘47’
and again it tests to FALSE.

Am I missing something obvious??

Thanks in advance.

If you take the constraint out does the message show and if so what value does the tag return in the message?

As a guess, in V5 - a Rule Actions Constraints are all read at once when the Rule Loads. Therefore the Value of {TICKET TAG:ORDER} is actually blank as “Load Ticket” Action has not fired.

If this is the Case you need to split this Rule into 2 Rules - Load/Open Ticket Rule , then a 2nd new Rule where you can then use that Constraint. I have been driven to near madness on this behavior once or twice :sweat:

1 Like

Yes, the message shows if I take out the constraint. The message returned is “Order 47” (minus the double quote ofcoz)

I supposed I didn’t understand you correctly @pauln I followed your suggestion and split the rule into 2

I am guessing when all rules with Automation Command Name matched will get executed in a sequential manner, which rules in higher order will get executed first…etc. Based on that theory I split one rule into rule A and B.

Rule A - Load the ticket then reopen the ticket
Rule B - Update ticket state, display message (with the constraint) then close ticket.

However when I tried invoke these two rules through Ticket Lister Widget, SambaPOS behaved weirdly (No message displayed) and eventually caused SambaPOS to crash.

Any thoughts on this? Thanks

Umm you used the same “Order Given PHONE” - try calling an Automation Command Executed Action with a 2nd name for Part B - maybe Samba just links them automatically and see them as 1 Rule.

I know we need to do this in V5 when using a “Prompt Question” - you definitely need to test the answer in another Rule else you get this type of behaviour.

EDIT: Is Ticket Tag result Numeric i.e. {TICKET TAG:ORDER} > 0 ?

1 Like

That ^ is exactly the reason why the Rule does not behave as you expect. @pauln is correct, and it is the same behavior in V4.

Yes, that ^ is the solution. You can even pass the Ticket Tag as the Command Value, and constrain the second Rule for that Command Value.

To ensure it is numeric, you can do this for the constraint, because it will change null or blank (or any non-numeric value) to zero …


Could you explain how you structured this? I don’t quite get it.

So the button in Ticket Lister Widget fires one Automation Command event, which the event get picked up by rule A, then rule A calls rule B??

I suppose {TICKET TAG:ORDER} is stored as a string. Having said that the value assigned to {TICKET TAG:ORDER} is a numeric value stored in Program Setting

Could you show me an example on how that’s done? Can’t get my head around it~~



Make an Execute Automation Command Action (it can be generic - you will use this a lot) …

Split your Rule into 2 parts… the first one for the Ticket Lister button, and the second one to respond to the ExecAMC action …

Done in that ^ way, you should be able to use any of the Rule Constraints demonstrated, or put the constraint in the MSG TEST Action would work too.

1 Like

Thanks for your help guys, saved me from going crazy :slight_smile:

I can see the GEN ExecAMC action would gets used fairly frequently :smile:

Thanks again

1 Like