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!

1 Formula For Different Products 1

Status
Not open for further replies.

Bennie47250

Programmer
Nov 8, 2001
515
US
Using crystal version 14 with an MS SQL Table

This formula is going in the suppressed details section and then I have a summary in the group footer

I’m fairly certain I have done something like this before but today I just can’t get the syntax correct. Would appreciate your help. Wanting to have 1 formula to capture the sales dollars for 2 different products. I created this and it is erroring out.

My formula is:

IF {Acct#} = 272044716001 AND
{Product_#} in ["BP0021"] and
{Year} = 2019
THEN
{Sell Dollars}
ELSE 0

or


{Acct#} = 272044050000 AND
{Product_#} in ["WE33"] and
{Year} = 2019
THEN
{Sell Dollars}
ELSE 0

When I check the formula I’m told The remaining text does not appear to be part of the formula and highlights the last THEN {Sell Dollars}ELSE 0

What is the proper syntax for this assuming it can be done.

Thanks
 
Use this syntax:

If
(
(
acctno=123 and
Prodno=“ABC”
) or
(
acctno=456 and
Prodno=“DEF”
)
) and
Year=2019 then
Sales$ else
0

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top