[Answered] Discount Tag Order intermittently functioning

Let me try that solution. If it works like I planned you’ll see we won’t need that since that will work like we configure our custom events.

Hello @QMcKay. Does it works as expected?

data45.zip (114.1 KB)

PS: You don’t need to configure Automation Command to be able to use Execute Automation Command action.

Excuse my ignorance on this subject @emre, but what do I do with this SDF file when I run SQL Express 2012 ?

You can open it via Query analyser and run

@Jesse, you’ve lost me… where is that? Are you suggesting I download SQLCE?

I am sorry aparently MS took out the option after 2012.

You can check to see if its in yours or not but
File: Connect Object Explorer: Change Server Type to SQL Server Compact Edition
From the Database Dropdown select browse for more then open your sdf file.

There may be an easier way if your SQL Express does not support the import but I found this for you… looked like it might work.

Looks like he coded something that will convert the .sdf to scripts you can import and then run yourself via management studio

He provides the code to so you can see exactly what his program is doing if your worried about security.

If you just want to view it there are several programs out there that will open it to view it. I use SDF Viewer

OK No need to install CE, I’ll try to create a SQL Server backup soon.

PS. Sorry for responding a little late. It is holiday in our country and I’m away from home atm.

Can I direct SambaPOS to use the SDF as a datasource without installing CE? I suppose not…

Hello. Sorry for late reply. Let me show few screen shots to demonstrate my idea.

This is Execute Automation Command action. It basically executes an action.

When I select an order and click Discount Button this rule executes.

It asks for [:?Discount Amount] and executes two automation commands. It sets Discount Amount to Command Value.

Hint multiple [?:X] queries executes once.

First automation command Executes Update Discount if Zero command and the other one executes Update Discount if Not Zero command. As you can see we set no constraints here. Since it executes automation commands we can use rule constraints.

Hint: We don’t need to add automation command records for Update Discount… Commands. We can just handle it by writing command name in rule constraint.

This is how Update Discount If Zero Rule configured.

Since I didn’t configured Update Discount if Zero command it will not appear in drop down list but I can type command name there. It simply checks if Command Value (Discount Amount) zero or empty and if so it executes Remove Discount action.

This is how I’ve configured Update Discount if Not Zero rule.

This one adds discount value if something entered other than 0 or nothing. As you can see I’m using [:CommandValue] to calculate discount amount.

I think this is more powerful than using action constraints.

1 Like

I think you’ll wonder what [:Desc] parameter does. Since I’ve enabled Add Order Tag price to Product price setting, discount amount is not visible on order line. This feature called Order Tag Note and it displays custom values next to tag name. This feature is only accessible through Tag Order action and I’ve used this feature to display discount amounts.

When I add $2 discount it appears as…

1 Like

@emre, thanks for the explanation. I have this set up and working fairly well, with 1 exception: when amount entered is 0 (zero), the Order Tag is not removed. Can you explain why this is? (see the screenshot at the very end).

Setting the rule constraint of Ru Discount Item Custom Not Zero to Matches All should solve that.

1 Like

@emre, that did the trick! Thanks again!

WHY?

I was sitting yesterday all day until (without reading this) i changed that by mistaque and suddendly everything worked…

Thanks!!!

G.

@emre, can you give some clarification between the different Rule Constraints please?

I understand these:

Matches Any:
(constraint1 is True) OR (constraint2 is True) OR (constraint3 is True)

Matches All:
(constraint1 is True) AND (constraint2 is True) AND (constraint3 is True)

Not Matches Any:
NOT(constraint1 is True) OR (constraint2 is True) OR (constraint3 is True))

Not Matches All:
NOT((constraint1 is True) AND (constraint2 is True) AND (constraint3 is True))

But I don’t understand this one: (I never use it)

Matches:
(constraint1 is True) ??? (constraint2 is True) ??? (constraint3 is True)

Matches does a magic match :slight_smile:

It compares constraint names and if constraint names are same they compared by OR, everything else by AND.

For example.

Customer name == Emre
Customer name == QMcKay
Date == Today
Date == Yesterday

Resolves to …

(
  (Customer Name == Emre) OR (Customer Name == QMcKay)
  AND
  (Date == Today) OR (Date == Yesterday)
)

So our sample resolves to…

Automation Command Name == Discount Item Custom NOT Zero
AND 
((Command Value != 0) OR (Command Value != Null))
2 Likes

Dear @Emre, I would like to see the Best seller, 1.000.000 pages, SambaPos manual… LOL!!!

THANKS!!!

G.

Nice! Good to know, and very cool magic!