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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple If Statements? 1

Status
Not open for further replies.

Kirath

Programmer
Mar 28, 2007
4
US
I've been trying to get a particular report to generate but I am having problems with getting a formula to work correctly with two if statements. I am pretty new to working with CR, so I could use a little help. I'm using the new 2008 version with MySQL db.

Everything seems to work ok when report is run thru the first if statement. But anything after that (the branch part in this case) is ignored. What am I doing improperly?
Any help appreciated.

{CUSTOMER.C_NUM} in {?Customer_Start} to {?Customer_End} and
{ORDERHDR.O_DATE} in {?Start_Date} to {?End_Date} and
If {?Sales_Order_Type} = "Order Entry" then
{ORDERHDR.O_TYPE} = "OE"
Else If {?Sales_Order_Type} = "Sale Entry" then
{ORDERHDR.O_TYPE} = "SE"
Else If {?Sales_Order_Type} = "Cash Sale" then
{ORDERHDR.O_TYPE} = "CS"
Else If {?Sales_Order_Type} = "Direct Sale" then
{ORDERHDR.O_TYPE} = "DS"
Else If {?Sales_Order_Type} = "Sale Return" then
{ORDERHDR.O_TYPE} = "SR"
Else If {?Sales_Order_Type} = "Cash Return" then
{ORDERHDR.O_TYPE} = "CR"
Else If {?Sales_Order_Type} = "Direct Return" then
{ORDERHDR.O_TYPE} = "DR"
Else If {?Sales_Order_Type} = "Branch Transfer" then
{ORDERHDR.O_TYPE} = "BT"
Else If {?Sales_Order_Type} = "Remote Order" then
{ORDERHDR.O_TYPE} = "RO"
Else If {?Sales_Order_Type} = "Quotation" then
{ORDERHDR.O_TYPE} = "QT"
Else If {?Sales_Order_Type} = "Tag & Hold" then
{ORDERHDR.O_TYPE} = "TH"
Else If {?Sales_Order_Type} = "Future Order" then
{ORDERHDR.O_TYPE} = "FO"
Else If {?Sales_Order_Type} = "Order Return" then
{ORDERHDR.O_TYPE} = "OR"
Else If {?Sales_Order_Type} = "Cash Order" then
{ORDERHDR.O_TYPE} = "CO"
Else If {?Sales_Order_Type} = "All Except BT, FO, and QT Orders" then
not ({ORDERHDR.O_TYPE} in ["BT", "FO", "QT"])
Else If {?Sales_Order_Type} = "ALL TYPES" then
{ORDERHDR.O_TYPE} <> " " &
If {ORDERHDR.O_BRANCH} = 0 then
{ORDERHDR.O_BRANCH} > 0
Else
{ORDERHDR.O_BRANCH} = {?Branch}
 
Hi

The problem seem that you are trying to use both STRING & NUMBER values. You need to use either STRING or NUMBER but not both together

Hope This Helps
 
You just need some parens. I made a couple of either small changes, too:

{CUSTOMER.C_NUM} in {?Customer_Start} to {?Customer_End} and
{ORDERHDR.O_DATE} in {?Start_Date} to {?End_Date} and
(
If {?Sales_Order_Type} = "Order Entry" then
{ORDERHDR.O_TYPE} = "OE"
Else If {?Sales_Order_Type} = "Sale Entry" then
{ORDERHDR.O_TYPE} = "SE"
Else If {?Sales_Order_Type} = "Cash Sale" then
{ORDERHDR.O_TYPE} = "CS"
Else If {?Sales_Order_Type} = "Direct Sale" then
{ORDERHDR.O_TYPE} = "DS"
Else If {?Sales_Order_Type} = "Sale Return" then
{ORDERHDR.O_TYPE} = "SR"
Else If {?Sales_Order_Type} = "Cash Return" then
{ORDERHDR.O_TYPE} = "CR"
Else If {?Sales_Order_Type} = "Direct Return" then
{ORDERHDR.O_TYPE} = "DR"
Else If {?Sales_Order_Type} = "Branch Transfer" then
{ORDERHDR.O_TYPE} = "BT"
Else If {?Sales_Order_Type} = "Remote Order" then
{ORDERHDR.O_TYPE} = "RO"
Else If {?Sales_Order_Type} = "Quotation" then
{ORDERHDR.O_TYPE} = "QT"
Else If {?Sales_Order_Type} = "Tag & Hold" then
{ORDERHDR.O_TYPE} = "TH"
Else If {?Sales_Order_Type} = "Future Order" then
{ORDERHDR.O_TYPE} = "FO"
Else If {?Sales_Order_Type} = "Order Return" then
{ORDERHDR.O_TYPE} = "OR"
Else If {?Sales_Order_Type} = "Cash Order" then
{ORDERHDR.O_TYPE} = "CO"
Else If {?Sales_Order_Type} = "All Except BT, FO, and QT Orders" then
not ({ORDERHDR.O_TYPE} in ["BT", "FO", "QT"])
Else If {?Sales_Order_Type} = "ALL TYPES" then
true
) and
(
If {ORDERHDR.O_BRANCH} <> 0 then
{ORDERHDR.O_BRANCH} = {?Branch} else
if {ORDERHDR.O_BRANCH} = 0 then
true
)

-LB
 
Hey guys, thanks for the replies.

LB, thanks.. that works great.. I knew it had to be something simple, but sometimes you just get so close to something you just can't see it. Much appreciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top