Is there a tutorial about constraints

Is there a tutorial about constraints, especially adding them in rules under actions

You mean Action Constraints?

Please read here it has good info.

1 Like

yes, i wanna know how to make action constraints or get an idea

Action constraints work just like Rules constraints, the only difference is that instead of 3 different fields to fill-in or select, you just have 1 field.

You are going to want to compare 2 any of these: report tags, printer tags (not all printer tags work, you will have to test them) and/or characters (text/numbers). In between these 2 comparisons you are going to want to use a Relational/conditional operator. They are going to be one of these ==, !=, >, <, >=,<= Here is a link to https://www.techtarget.com/whatis/definition/operator#:~:text=In%20mathematics%20and%20computer%20programming,logical%20AND%20function%20in%20programming scroll down to 2. Relational operators it will explain what each one does.

As in the article @Jesse posted, it is used to remove the action(s) from the rule list.

To do some testing, please review this tutorial:

Using the show message action if you put a constraint in as: 'a' == 'a' (we put quotes around each side to help isolate each comparison.) This is saying we only want this action to fire when a equals a. You can test this by going to the pos screen and pressing the test button. Make sure you have some text inside the message field of the action.

Now if we change the action constraint to 'a' == 'b' and try to test it, you will see nothing will happen. This is saying we only want the action to fire when a equals b. Since a will never equal b this action will never fire.

Now change the constraint to 'a' != 'a' and test. Again this will not fire because we have the statement of only work when a not equal a. Since a is equal to itself this will also never fire.

Now change the constraint to 'a' != 'b' and test. Now it will always fire because a not equal b.

Lets change the letters above with something else. Enter this into the show message constrains: '{TICKET TYPE}' == 'Ticket' (if you use a different ticket type name, use your name for Ticket). Also enter it into the message field.
ciO5pGP3u3

Go to the POS screen, add an item to the screen (this needs to be done to create a ticket, otherwise the ticket type is blank), and press the Test button. The message will show what is going on in the constraints. If you change the 'Ticket' to 'XTickets' in both the constraints and message and test again, it will not fire. Remove the constraint (leave blank) but leave the message and test again, you will see why it did not fire.

You can also have multiple comparisons using AND / OR or && / || respectively. It would look something like this:
'a' == 'a' AND 'b' == 'b' or another of writing this would be 'a' == 'a' && 'b' == 'b'
This is saying when a equals a AND b equals b then fire. Both comparison need to be true.

'a' == 'a' OR 'b' == 'b' or another of writing this would be 'a' == 'a' || 'b' == 'b'
This is saying when a equals a OR b equals b then fire. Only One comparison need to be true.

Using this comparisons gets a little tricky because you have to make sure the statements you are making is logical.

Hopefully this will help get you started.

2 Likes

The biggest thing to understand about action constraints is they do not check them in sequence with actions. They are all evaluated at once before.

1 Like