Formula = ?

I am trying to create a column in a report that will give me the sum of the original retail price for all items on sale.

I have tried

Formula = ''where Item.SalePrice > 0, Item.Price * Item.Quantity"

I get an error around the "where"...is there another way to say this?

Formula = ''Item.Quantity*Item.SalePrice/Item.SalePrice*Item.Price"

This would work except for the divide by 0 issue. Any ideas?

Thanks!

Reply to
Kat Straub
Loading thread data ...

Hi Kat,

You would need to use a Case Statement

Formula = "case when Item.SalePrice > 0 then Item.Price * Item.Quantity else

0 end"

The next formula could again use a case statement to avoid the divide by 0 issue

Formula = "case when Item.SalePrice*Item.Price = 0 then 0 else Item.Quantity*Item.SalePrice/Item.SalePrice*Item.Price end"

Hope this is right and helps!

Peter

Reply to
Peter

You need to use a case statement instead of the where, and make sure to use the transactionentry.quantity and not item.quantity. Example:

Formula="CASE Item..Price WHEN 0 THEN 0 ELSE TransactionEntry.Quantity*Transactionentry.Price/Item.Price END"

Watch out for line wrap, make sure the formula is all on one line.

Also make sure that you are aware of what field have what meaning so your formula gives you the correct result: transactionentry.quantity - how many of that item was sold in the current transaction item.quantity - current remaining stock on hand of the item transactionentry.price - price item was sold for in the current transaction item.price - full retail price of item item.saleprice - price item will ring up as if item.saletype=1 and date between item.salestartdate and item.saleenddate. (basically setting the item on 'sale')

Reply to
Matt Hurst

Reply to
Kat Straub

BeanSmart website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.