[New 4.1.7] Asking Action Parameter Values

By using [?ParameterName] notation you can ask action parameter values.

This action displays a Message Box when we click on an automation command. Since we supplied Message Parameter Value as [?Message] SambaPOS would ask a value for Message parameter before executing action.

That window should appear when we execute the action. We should type a value for Message parameter and rule will execute with typed value.

Clicking “Cancel” will abort whole rule execution so it can be used for confirmation purposes in some cases.

This feature improved with 4.1.9 update. Let me show another example.

We have a discount button under ticket. When we click that a dialog box appears.

I can type a discount rate between 1 to 10. Also I can type a discount reason.

I’ve entered rate as 5 and typed “New Customer” as discount reason.


###Automation Command

We need an Automation Command for discount button.

I named it as “Discount” and the button header is also “Discount”. I’m switching to Mapping tab for configuring button appearance.

This button is enabled when Ticket State is “New Orders” or “Unpaid” so we can’t click it if ticket is paid. I’ve also selected “Display under ticket” setting to make this button appear under ticket.

After saving it I need to click “Sort Automation Commands” link and move it to the top of the list. So it displays just before Settle Button.

###Update Discount Action

I’ll create an action to update Ticket Discount value.

Action type should be Update Ticket Calculation. I need to select “Discount” for Calculation Type and type [:Discount Amount] for the Amount value. [:Discount Amount] means we’ll send this value from rule.

###Update Discount Reason Action

This action will store discount reason as a ticket tag.

Action Type will be Update Ticket Tag and I’ll type [:Discount Reason] to be able to send this value from rule.

###Refresh Ticket Action

This action just needed to refresh ticket display.

When we leave ticket Id as 0 it just refreshes current ticket.

##Discount Button Rule

We need a rule to tell SambaPOS what to do when we click on the Discount button.

The event we need to handle is “Automation Command Executed” It triggered when we click on Discount button. We need to check Command Name with a custom constraint to make sure it is Discount Button.

I’ve clicked “Select Actions” link to map actions to the rule. When we click on discount button these actions starts working one by one.

I’ve expanded “Update Discount Reason” action to configure action values. We want to ask Discount Reason to the operator. I’ll type it as [?Discount Rate] so SambaPOS displays a dialog box that asks Discount Reason.

On next step I’ll configure Discount Rate value. I’ll also ask this value to operator so I need to type [?Discount Rate]. We need little more configuration here because it will allow all characters inside Discount Rate. We need to accept only numeric values between 1 and 10. To be able to do this we’ll configure a input mask. We can type input masks by adding a semicolon after value label as [?DiscountRate:Mask]

Masks are configured as Regular Expressions. For accepting values from 1 to 10 we need to type [1-9]|10 It means a single numeric value between 1 and 9 or 10. Pipe character means or.

Feel free to ask how to configure input masks for your needs.

1 Like

Database Tools file download for this sample.

asking-discount-button.zip (864 Bytes)

may i ask what if the amount is more than 10% lets say 50% is this the correct mask [?Discount Rate:[1-9]|10|11|12|13|14|15] …continue up to 50?

Shorter expressions could be used. Something like:


Read as:
1 to 9 or
1 to 4 and 0 to 9 or

Google: regular expression number 10 to 50

1 Like

tried this [1-9]|50 and its okay if the discount 50 but if its 49 its not showing

It makes sense that it wouldn’t work. Use what I suggested, again…


This means:
(1 to 9) or ((1 to 4) and (0 to 9)) or 50


my fault i did not listen to you i thought i will choose from you expression i should use them as it is. thanks a lot i learned something today :smile:

How to mask : Colon?
I try to mask time format but I can’t put colon in the expression. SambaPOS will crash.
The Regex I use is ([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]

Why are you masking Time Format? and where are you trying to use this?

For Take out order, sometime customer call to order in advance 30-60min.

Can you show the rule/action your using it in? So when they call in an advance order… how do you handle it… and where is this Time Input going?

Action Name: Pickup Time
Action Type: Update Ticket Tag
Tag Name: Pickup Time
Tag Value: [:Pickup Time]

Rule Event: Automation Command Executed
Action: Pickup Time
Pickup Time: [?Pickup Time:([0-9]|0[0-9]|1[0-9]|2[0-3])(’)[0-5][0-9]]

Printer Template:
Pickup Time: {TIGKET TAG:Pickup Time}

That would be a Bug by the looks of it. I assume it’s because @emre is using the : to separate the Question from the Mask…

[?This is the Question:thisisthemask]

I think there might be a better way to input date. I am not sure but [=FD(ADD(’{TICKET DATE}’,1),‘dd/MM/yyyy’)] lets you add days to Date I wonder if you can add minutes.

I found Raised Colon ˸
It works! Yah

1 Like

This is kind of off topic now but: I am still interested in if [=FD(ADD(’{TICKET DATE}’,1),‘dd/MM/yyyy’)] could be used to add Minutes. If we had option to add minute you could simply input minutes and it would timestamp it automatically without having to input the entire time.

Maybe I will make it into a question.

Can you elaborate please? What does that mean?

Use Raised Colon instead of Colon and masking works
[?Pickup Time:([0-9]|0[0-9]|1[0-9]|2[0-3])(:)[0-5][0-9]]

This is wonderful! Thank you! I have added a custom item discount button that asks the percentage and the reason.

This works perfectly. However, the ticket tag is a singular value (and thusly gets overwritten when discounting more than one item.). Would it be possible to apply the reason to the particular line on the ticket that has been discounted (much like one adds *** DISCOUNT)?