Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate a price based on a category

Status
Not open for further replies.

ekr

Technical User
Jun 12, 2008
11
US
Hello-

My dataset has 500 items, each with a unique price. Each of these items is associated with a category. Based on the category, I want my report to calculate a new price.

For example, if the category is A, multiply the price column by 10.

If the category is B, multiply price column by 20. and so on...

I this possible in Crystal and if so, how do I do it? I am not very savvy with the formula fields, but I am very determined to solve this. Any help you can provide would be helpful! Thanks in advance.

E. Rice
 
Create a formula {@revisedprice} like this:

select {table.category}
case "A" : {table.price}*10
case "B" : {table.price}*20
default : {table.price}

-LB
 
Thanks for the help. I am getting some error messages that I can't seem to blast through:

"A number or currency amount is required here." (in front of {details.List Price} ) OR
"The remaining text does not appear to be part of the formula."

If I put a number there, it multiplies it x 10 vs. pulling the price from the field.

Here is my formula- where does it need to be corrected?

select {price category.Field1}
case "General":{details.List Price}*10
case "Mixed": {details.List Price}*20
case "Metal Only": {details.List Price}*30
case "Purchased": {details.List Price}*40
default:{details.List Price}
 
What datatype is {deatils.List Price}? Right click on it and browse to see the datatype or run your mouse over it and observe the tooltip text.

-LB
 
select {price category.Field1}
case "General": tonumber({details.List Price})*10
case "Mixed": tonumber({details.List Price})*20
case "Metal Only": tonumber({details.List Price})*30
case "Purchased": tonumber({details.List Price})*40
default: tonumber({details.List Price})

-LB
 
Thank you x 1,000,000! This works perfectly and I would never have been able to figure it out without the help. I sincerely appreciate your taking the time to share your knowledge.

E. Rice
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top