Constraints and Custom Constraint

Hello everyone!

I hope you are having a great day!

So I looked on the forum for some sort of low stock warning and found this -> Low stock warning


I made a rule that checks if there are less than 15 items in the inventory. If its true, it pops up a message “You have less than 15 [:MenuItemName] in stock.”

Than, I made a rule that checks if there are 0 items in stock and if its true, it cancels the order.

Then I had encountered tiny problem because both rules are always checked and when both were true ie. I had 0 packets of cigarettes in stock it would play both messages. Which was annoying.

From here I played with constraints and their conditioning. I got confused as to both things seem to work and I am not sure whether that was a lucky mistake or it can be used in this manner.

In first picture I have my values and conditioning in Custom Constraint list - I tried having it within the Action constraint using && (and logical operator) but it didnt work at all.

In this picture I have my condition in Constraint within the Action

So does this basically do the same thing?

Why is the value within ‘’ inside the Action Constraint? Does it read it as a string?
Is there some sort of documentation about these tiny details on the forum?

Kind regards

On a side note, when using less or larger than in order constraints you are best to always use TN() arround the report expression.
The quotes are likely string related so you will probably fine issue with 0or negative stock qty.
I’m pretty sure if you used TN() on the inventory part and dropped the quotes on the 1 it would work since they are values rather than strings which was maybe your issue before.
That’s based on that a quick way to disable an action is to set constraint of 1==2 without brackets since they are both numbers.
Generally using TN() on report expressions is a good practice where returning a number to ensure everything is parsed)handled as such.


Thanks JTR! Ill keep it mind.