Urgent ... Weird behaviour when incrementing system variable

Ive always been under the impression for a rule;
Rule constraints obviously define if the rule triggers on specified event.
Then all action constraints are evaluated and actions short listed before any actions fire.
Then actions are run in sequence.
This often becomes the reason for splitting a rule using an execute automation command action so you can run a few actions then run a few more based on what those actions have done.
I am not sure what happens with execute automation command action if the branch of automation from it happens before the next action in that rule or if it runs in parallel but typical use is to do seperate things or last action to follow on so never had a senario where it was important.

If actions didnt happen in sequence flows like my booking setup would be buggy as it contains a create entity and update entity and if they ran asynchronously the update would not have an entity to update.

1 Like

Another day in Paradise ā€¦

not working.
That is the yesterday night tickets, same thing happened, now incremented with @QMcKay [=x+1].

Now I am using {:GLOBAL SETTING blablabla}
I will try with {:SETTING: blablabla}, wait 4 hours for the lunch time (2 waitresses)
If not working I will try {:blablabla}, wait until the night shift (2 waitresses)

However itā€™d be nice that sombody explains me what are theses syntaxes.
These IsLocal or these GLOBAL ā€¦

  • do they refer to the programming language? like local to a functions, methods, classes?; global to main?
  • or is it a vocabulary specific to SambaPOS? like GLOBAL means ā€œSQL Soredā€; local means ā€œnot SQL Storedā€

I see something like this:

One waitress is working (logged in windows, ā€œherā€ SambaPOS started) - all good, SerialNumber walks one by one.

The 2nd waitress comes in (logs in windows, starts her instance of SambaPOS), starts to send orders and finally charges her first customer with the current DB SerialNumber, letā€™s say SerialNumber #10.

During that time the first waitress charges her customers (she has of course more) and SerialNumbers goes up, letā€™s say:
8
9
10
10 (?)
11
12
13
The second waitress charges her 2nd customer and her SerialNumber will be 11.
Her 3rd customer will be 12; then 13; etc ā€¦

So I finally have (2nd waitress in bold)
8
9
10
11
12
13
11
14
12
15
13
ā€“ first waitress leaves
14
15
16, etc ā€¦ till the next shift.


(Note 1: the first row is the SerialNumber today)
(Note 2: donā€™t look at the name, these are Ticket related, not Payment related and that SerialNumber is setup when Payment is made)
(Note 3: any waitresses -TU- can order for the same table; the one who settles -PU- the table receives the money and print the SerialNumber)

Ive always used {SETTING:xxx}

Question:

@QMcKay : in your exemple, Update is not a variable; Is Local is a variable
in JTRTech exemple, Update is a variable; Is Local is not a variable :

Which one is correct? Both?

It isnt really in mine either, I changed it as at the time you were still using increase.
I usually have two setting actions one for global and one for local.
Both only ā€˜carryā€™ the fields (<-- better term than variable) for setting name and value.
I only ever use update (not increase etc) and islocal is set depening on which of the two actions it is Global or Local.

1 Like

No.

Yes.

Local, stored in memory on the Terminal (in the SambaPOS instance memory space):

{LOCAL SETTING:SerialNumber}
Is Local = True

Global, store in the Database:

{GLOBAL SETTING:SerialNumber}
Is Local = False

Could be Local or Global, depending on how the Program Setting was ā€œsetā€:

{:SerialNumber} // generally refers to a setting that is in-memory (Local)
{SETTING:SerialNumber} // this is a PRINTER TAG that can access a Program Setting, whether it be Local or Global

Both. It is up to you which you use.

The difference is that when you use [:variables] for all Action Parameters, then the Action is FULLY GENERIC, meaning that you can use it in ANY Rule, and supply the Action Parameter Values in the Rule. You could define FULLY GENERIC Actions for every Action Type, and never define another Action again. You would then use the Generic Actions in any Rule, and set the Action Parameter Values in the Rule.

If you choose to hard-code some Action Parameters, (ie. Update Type:Update or Is Local: True), and use [:variables] for other Action Parameters, then the Action is no longer FULLY Generic in that some Parameters are hard-coded, and you cannot change them in the Rule, while the Parameters for which you used a [:variable] can be changed/set in the Rule.


Someone with an RDP setup needs to test this. Unless you have something wrong in your Rules, then it must be the RDP causing this. I am out of ideas.

Iā€™m using RDP, 1 server and 2 tablets. I donā€™t have issue but I never both tablet settle at the same time. Most of the time I use sever to settle 90% of the bill. Server has cash drawer and credit card terminal so I always use server.

That is what I am using.

  • Is Local:False for the Update Program Setting action (with {GLOBAL SETTING:SerialNumber} as parameter to add 1)
  • {GLOBAL SETTING:SerialNumber} to tag the ticket.

Iā€™ll split the actions in 2 different rules as suggested.
If that works Iā€™ll be frustrated because Iā€™ll not understand why it was not working in the same rule, as you said:


Rules & Actions

Same for Credit Card

I have another idea.

Set your Payment Processed Rule Constraints to use:

Remaining Amount Less Than 0.01

And in that Action Constraint, use this instead:

[=TN('[:RemainingAmount]')] <= 0

ok, got it

2nd waitress clocking in in an hour

why not < 0.01 in action constraint ?
I might have (rarely, ok) remaining account = 0.008 (rounding), so ticket is tagged and printed but SerialNumber is not increased by 1.

2nd waitress in.

settled 1 tkt, so far so good

ā€¦

13:42 So far, still so good ā€¦

Because <=0 is better than <0.01

If we could do Less or Equal in a Rule Constraint, I would have said use Less or Equal 0 ā€¦ but we donā€™t have that condition to choose for Rule Constraints.

Then best to change your Rule Constraints to:

Remaining Amount Less 0.0001

ā€¦ and Action Constraints to:

[=TN('[:RemainingAmount]')] < 0.0001

Hmm, I believe RDP issue now. It is random sometime correct sometime donā€™t. It seem it canā€™t read Global Setting (Database) and use Local Setting (memory) instead sometime.

Waitā€¦I test Show Message before settling 2 RDP at the same time. It actually read correct value but when settle I got different number for Ex Show message both show 10 but when settle both at the same time I got 9 and 11.

I have to try move action to different rule. Now it all the same rule.

tired ā€¦

@plume, please show the Action definitions for ACM Execute Auto Print Cash / Credit Card. If they are Execute Automation Command Actions, please also show the Rules that are defined to handle the Automation Commands.

no automation command, executed when payment processed

action def.

I want to see the Action definition for this (and the same for Cash):

here it is (thatā€™s the standard one that comes with SambaPOS, did not touch a thing)

CC

Ok thank you - they are Execute Print Job actions I see.

I thought by their name they were Execute Automation Command actions (ie. I though ā€œACMā€ was an acronym for Automation Command).

I am going to set something up for you to try. BIAB.

Actually, I use {:xxx} which is now mean Local Memory Setting. Now I change to {GLOBAL SETTING:xxx} and it read value correctly but if settle both tablet at the same time, I got the same number which is make sense.