Help with expression

Ive created separate accounts for customer discounts and staff discount whereby when a customer or staff card is swiped it adds that customer or staff (entity) to the ticket and discounts the relevant %. This could be set up so that if there were customers of different discount levels their card number would correspond to the discount level they receive when swiped (or barcode scanned or keyed in)

These values show up perfect in my account screen as shown below

This issue i have is with the manual discount buttons i have setup to discount an order line (1 item, not full ticket as in the above example)

The discount AMOUNT button works fine, i added an account transaction for the command value so whatever i manually type as a discount is a value and this shows fine on my accounts, in the below example i manually discounted £1

Now to my issue, when i use my manual discount PERCENTAGE button i cant use command value as the amount discounted as if i discount 50% accounts will add £50 to the £1 in the above example giving a total manual discount of £51. However i need to 50% converting into the actual value of discount that the 50% equates to to add to my account screen to give me the total VALUE in manual discount. What i need is a correct expression to go in the below action

Expressions arnt my strong point but i think i need something that works out the following:

Discount Value = Order Price x (command value/100)
Discount Value = £1.00 x (50/100)
Discount Value = £1.00 x 0.5
Discount Value = 0.5 - This is the value i need adding to accounts NOT the 50% command value entered

I dont know what the correct expression format should be anyone have any ideas?

You never closed the expression. you have

[=TN('{ORDERS}')*TN('[:CommandValue]')]/100  

Try

[=F(TN('{ORDERS}')*[:CommandValue])/100]

Although I am not sure thats correct way to use CommandValue

Thanks, I wasnt sure either if that could be done with Command Value, ill try it later today and let you know

It should work fine with [:CommandValue], but your Order Price probably needs to be {PRICE}, not {ORDERS}.

As always, I find the best way to test expressions is to use a Message Box to display your expression to know if it calculating things properly… that way you’ll be able to figure out what is available as Tags, and whether they need to be converted using TN().

[=F(TN(’{ORDERS}’)*[:CommandValue])/100]

this expression almost worked, but it didnt do the divide by 100 properly, i did a sale of 50% and the value of this discount was 0.62. instead of adding 0.62 onto accounts it added 62

EDIT - fixed it just needed an extra set of () around the command value/100 bit so the following equation worked

[=F(TN(’{PRICE}’)*([:CommandValue])/100)]

thanks for your help as always :slight_smile: