Add Constraint to action

Is there a way to add a constraint to an action so it won’t run if there are no items on the ticket.

I’ve got a unique crash now resulting from the switching user function.

If I add an item to the ticket and then cancel it, there’s no way to get off the screen. If I close the ticket, it crashes as it’s trying to save / clear the ticket to the user. Is there a constraint I can put in so that if there’s nothing there it will skip that part.

Can you post the rule and action in question.

Close ticket Rule


Switch User (Log off Rule)

So it crashes when you press the Log Off button?

Yeah, or storing. Only if the user has added an item and then cancelled it so there are no items in the ticket… They then have no way to log off as it crashes.
They can’t press these buttons if nothing has ever been added to a ticket because of the mapping on the automation command.

It’s a fantastic crash too - the error reporting dialog comes up behind the main window. As these are touch screens with no keyboard, the only way round is to press the power button on the machine!!!

First, you shouldn’t use Mark Ticket As Closed in your Log Off automation rule as this tells SambaPOS that the ticket is finished and locked. You should only Close Ticket until the customer has settled and left.

In both Log Off & Close Ticket rules you have {USER NAME}. This is not available for Automation Command events, you should use {:USER NAME} which if I remember correctly, you set when a user logs in.

It should be {:CURRENTUSER}

Thanks @Emre, that makes things a little easier.
The original setup of this actually set {:USER NAME} variable at user Log In so we could recall later to get around this issue.

SambaPOS already stores these local state variables by default. You can access these with setting access syntax.

CURRENTUSER    Stores current user name
ENTITYSCREEN   Stores current entity screen name
DEPARTMENT     Stores active department name
NUMBERPAD      Stores current numberpad value
ISLOCKED       Useful to determine if there is an active ticket.

Changing from {USERNAME} to {:CURRENTUSER} means that it now doesn’t store the value and doesn’t work… {USERNAME} did work except with a blank ticket (hence the request for a constraint)

This is what I have now.

as you can see, it’s not storing anything now.

1 Like

Sid latest update should fix crash issue on using {USER NAME} tag. It reads User Name from last order line and since you don’t have any line that generates an error. Latest update will just return empty string value so you can add a constraint to test if {USER NAME} is empty or not.

thanks - I will update the tills tonight when it’s quiet.