A better way for making the Rules

Hi guys,
I wonder, is there any way to add else case in rule constraints? or giving nested action for each constraints?

In this Exapmle I wanted to print once if ticket type is DINE IN
else twice. So if there is an else case It will be easy naa!!!..:sunglasses:

So we can use the rules more customised way.
correct me If am wrong.


In your case, better way is clone the rule and change DINE IN to TAKEAWAY

You can pretty much achieve this using just one rule with multiple actions, each of the actions can have a contraint to dictate which one of the actions will fire.

For exmple the rule could fire on Payment Processed with a Rule Constraint of Remaining Amount Equals 0 (if required).

Then below you could add the multiple duplicate actions, for example add an “Execute Print Job” action twice. (To add the same action multiple times you need to right-click on the list of available actions and select “Display All” - more info here)

The conditions could be like:

Execute Print Job
Print job: PrintBill
Copies: 2

Execute Print Job
Print job: PrintBill
Copies: 1

Note, you need to use the ' characters in the above conditions and also, remember that this compare operation is CaSE SenSITivE

So, The rule will be run evertime a payment is made, but these action conditions are helping us determine which of the actions should be run. If you have many actions you can fire them selectively as approriate using a variety of condition statements.


Changed to a question as this is already easily done.
As @mjb2000 demonstraints you just make you copies field carry to the rule using [:Copies] in the action, add ones, then right click and select show all actions to add a second time then define action constraints on each to suite the situation.

Hi, this one I already done .
I jus showed one example, there are several cases that we could do the work with else case easly.
By that we can have multiple actions with different cases.

Oh, OK. So what are you trying to achieve? I’m a little confused about how an ELSE statement could be implemented?

You can already do this with action constraints which are not the same as custom constraint that you showed.

1 Like

That is what action constraints are for…

or do you mean using AND/&& and OR/|| (double pipe) in constraints?

&& for and and || (double pipe for or);

You can also use brackets for complex constraintslike;

X==Y && (A==B || A==C)

Being if X equals Y AND A equals B OR C

1 Like

Could also do it with a single Action and use a Ternary operator (which is an IF/THEN/ELSE operation) in the “Copies” parameter:

Execute Print Job
Contraint: (none)
Print job: PrintBill
Copies: [= '{TICKET TAG:TICKET TYPE}' == 'TAKEAWAY' ? '2' : '1']


Gave an expert solution.
Leave the example,
As u guys said, we can do work with constraints. My point is, else case in rules can be more ease to understand and implement for people like us.

Cases means , different constraints in same rule, so that different actions can run based on different constraints.

You can use all kinds of combinations of Action constraints you do not even have to use a ternary like he showed but that certainly can be done. You could use two actions each with a different constraint in the same rule that also in effect does the same thing as what you were asking.

Some actions may not work with a ternary expression like that meaning you would need to use two actions each with a different action constraint. It will execute the action that meets its constraint and ignore the one that doesnt… all in the same rule.

See how I used action constraints there all in same rule. It will only execute the action that matches its constraint and ignore the one that doesnt.


See, which is better? Giving constraints to the actions or to the rules?
I would say rules,
I hope I can explain,
Jus take an example,
A and Z are actions
B,C,D and Emy cases for printing on different constraints.
I can give like
if B? Action A,
Else if C? Action A [one more constraint if needed]
Else if D?Action A [ constraint if needed]
Else If E? Action Z.

So we can reduce the number of rules as well as number different actions.
I don’t have any idea about the work flow or work load. Correct me if am wrong please…

So you are missing the point. Rule constraints are there for a reason and so are action constraints. You can use a combination of both. We already can do what you are asking and its been shown how but you are not seeing it.

You can use a single action and use parameters in it making it generic and then that single action can be used for multiple automation none of them being the same. You can even use that same action twice in the same rule and it can execute two things.

Basically you probably need to practice more with the program to understand what I am saying but the way it is designed now is way more flexible and offers greater control. The way you are asking for it to be would restrict it and make automation much harder.

You are essentially asking for a feature to be taken away which is action constraints and have it all run from rules. more than half of the tutorials would not be possible if we did that. A majority of advanced setups would simply not work and would not be possible.

I have several automatons that use both.


This is completely achieveable using action contraints. You don’t need to use the word “ELSE” because by definition is it is not B then action A won’t be fired. Then when your next action is evaluated, if it is C then that action will be fired. Just put a series of actions in your rule and define which ones you want to fire using constaints.

In terms of Rule Constraints vs Action Constraints it’s not a matter of one or the other, it’s about using the right combination. A good example of when to use each type would be processing credit card payments, let’s say I want to display a message to remind the operator what fo do with each card transaction.

In the above example, this RULE will only fire when a credit card transaction takes place (since I’m not worried about displaying messages when a card is not involved).
Then, for each of the ACTIONS they are evaluated individually to work out which message to display.

You could think of this as

if card = true and name = visa then "Red Folder" 
else if card = true and name = mastercard then "Red Folder"
else if card = true and name = amex then "Blue Folder"

So this is how ELSE is handled already by SambaPOS.

Does this help clear it up a little?