Urgent ... Weird behaviour when incrementing system variable

Is local set to false works and it is easy to test that. I use that setting extensively in multiple different configurations so I know without a doubt it’s working. There is something specific to your setup that is not working as desired.

In fact I use it for the exact same thing your trying to do and it has never not worked. I call mine order # instead of serial number but it’s all the same. I think your issue is something to do with your RDP setup.

Yes, you can create many Scripts. And the Scripts can be JScript or SQL. And those scripts (JScript) can have multiple Functions/methods within them. One JScript script could contain Function(s) that have the same name as Functions in another JScript script.

The Handler is to know which Script you are referencing.

SQL Scripts always have this format for the Handler using leading @@:

@@handlerName

JScript Scripts just have a string for the Handler:

handlerName

Then to fire a Function in a JScript, you call it by invoking:

handlerName.functionName(funcParameters)

You can also “call” Scripts using the {CALL:X} Tag, for example, in a Printer or Report Template, or in a Rule:

{CALL:handlerName.functionName(funcParms)}

The result (return value) of the Script will be used in place of the {CALL:X}. So in the case of the JScript that I wrote above, this:

{CALL:setting.updateGlobalSQL('SerialNumber','increase')}

… will return the updated value of the SerialNumber, because the function returns newValue.

So you could reduce your Rule by 1 Action, to use {CALL:X} which will UPDATE and return the Updated Value …

[=TN("{CALL:setting.updateGlobalSQL('SerialNumber','increase')}")]


##No Change Due:

##Change Due:

1 Like

Hi kendash,

Forget about that rdp stuff; yesterday I ask the waitresses to setlle directly (no rdp) on the main computer, each of them using their windows user session without closing the windows session of the other - “cambiar usuario”. So change (windows) user and not close (windows) session.
That way 2 SambaPOS running for 2 users, I got the same result.


That is exactly what happens (thanks @sukasem ) and this is sukasem setup.

Update Program Setting

Is Local : False means SQL stored (QMcKay)

In case of Update, it should:

  1. Read the setting value - in our case we give {:GLOBAL SETTING:SerialNo}
  2. SQL update that value to database

And this is not the case if more than 1 SamPOS program is running.
(actually the same problem occurs with only one SambaPOS running but it will not create issue)

So,

  1. OR the value we pass is wrong - {:GLOBAL SETTING:SerialNo}
  2. OR the Program Setting Update does not SQL store that value in the database.
  3. OR once SambaPOS has read once from the database {:GLOBAL SETTING:SerialNo}, it is happy and works with that value in a variable. If this is the case, it would make sense (using programming vocabulary) to put Is Local = True , that way the variable that contains {:GLOBAL SETTING:SerialNo} will only be used once (local variable) by that action and the next time it execute that same action, it would have to re-read the database.

The guys who wrote that part could answer in a sec.

Before using QMcKay script to completly replace that action, I am doing a last try with that Update Program Setting action, giving the following as the Setting Value:
[=TN('{REPORT SQL DETAILS:SELECT [Value] FROM [ProgramSettingValues] WHERE [Name]='SerialNumber':F.Value}') + 1]

If I still see the problem, I can discard nº1 to be the problem, so it is nº2 or nº3.

Good to know. So you are claiming that this issue is a result of running more than a single Windows User Session. Interesting. Now I have a way for me to test this without RDP. Thanks for that.

EDIT: Hmm… seems I need to learn how to run SambaPOS in multiple User Sessions… right now, one session/instance is logged in and WP is started, but in the other session/instance, the WP is closed… why are they not “aware of each-other”? I even have the Terminals set uniquely in Local Settings in each session…

10 posts were split to a new topic: SambaPOS in multiple Windows User Sessions

:confused:
2nd waitress clocked in an hour ago, no doubles right now … but not a lot of customers this lunch time … let’s wait.

I currently have the Script/Report method running, and no doubles.

Switched to Update +1 method without Report Tag, no doubles…

Switched to Increase Value 1, no doubles…

@plume,

Please post the Report you are using to track the SerialNumber Tag.

(Btw I don’t really need that reports to see doubles, the printed tickets are enough)

[SerialNumber:1, 3, 5]

{REPORT SQL DETAILS:

SELECT Id,Value,Name

FROM ProgramSettingValues

WHERE Id = '23'

:F.Id,F.Value,F.Name}



[Table Custom:2,2, 3, 2]

>Terminal|T Numb|SerialNumber|Amount

{REPORT TICKET DETAILS:T.Terminal,T.TicketNumber,TT.SunatNumber.desc,T.TotalAmount:}

I was told to use:
{GLOBAL SETTING:SerialNumber}
instead of
{SETTING:SerialNumber}

I am almost sure that will give NO double, I am just making a last try this lunch time replacing:

{GLOBAL SETTING:SerialNumber}
by
[=TN('{REPORT SQL DETAILS:SELECT [Value] FROM [ProgramSettingValues] WHERE [Name]='SerialNumber':F.Value}')]

Then I’ll use you script.

##Report

[Ticket Serials:1,2,2,1,2,2,2]
>>DB|{REPORT SQL DETAILS:SELECT [Value] FROM [ProgramSettingValues] WHERE [Name]='SerialNumber':F.Value}

>>Payment
>tNum|tDate|pDate|Ser|tUser|pUser|Terminal
{REPORT PAYMENT DETAILS:T.TicketNumber,T.Time,P.Time,TT.SerNum.desc,T.User,P.User,T.Terminal}

>>Ticket
>tNum|tDate|pDate|Ser|tUser|pUser|Terminal
{REPORT TICKET DETAILS:T.TicketNumber,T.Time,T.LastPaymentDate,TT.SerNum.desc,T.User,-,T.Terminal}

The only diff I see is:

In Yellow, my “TagValue” variable’s name was : “SerialNumber” I don’t know if it has impact

Could you try with that?

UPDATE:

Got doubles.

Still no doubles.

Should not matter.

The variable name in the Action is not related to the Program Setting Name… erm, at least it shouldn’t be!


Shouldn’t make any difference, but I will try it.

Currently still using Update+1 method, without Report (using {SETTING:SerialNumber}).

Do you mean to say use {GLOBAL SETTING:SerialNumber} in the Update and the Tag?

Is that mean Update Program Setting use value store in memory when Update Type set to Increase?