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

Nested If-Then-Else Statement

Status
Not open for further replies.

SeaninSeattle

IS-IT--Management
Sep 17, 2001
53
US
Help -

I'm working on a nested If-Then-Else statement, so it knocks out the cost shown on a certain type of inventory product. Can someone look at the formula below and tell me where I'm going wrong?

The first part of the statement (the inner and first statement) looks at the type and zeros the cost if it's that type. The second, outer part of the statement looks to see the order type and reverses the values if it's a return (we're a distributor of broadcast equipment).

Thanks,
Sean in Seattle
-------------

((If {IV00101.ITEMTYPE} = 3 Then {SlsRptResc.UNITCOST} = 0.00 Else {SlsRptResc.UNITCOST})
If {SlsRptResc.SOPTYPE} = 4 Then {SlsRptResc.UNITCOST} *-1 Else {SlsRptResc.UNITCOST})
 
Try...

If {IV00101.ITEMTYPE} = 3
Then 0.00
Else If {SlsRptResc.SOPTYPE} = 4
Then {SlsRptResc.UNITCOST} * -1
Else {SlsRptResc.UNITCOST}

Hth,
Geoff
 
Ok - this problem is a bit more involved than I thought. The problem is this:

Some of our items are contained in packages or "kits". These kits show up on the reports, as well as the components of the kits. When this happens, the total cost, price and margin is off.

The only way I can figure this out, is to zero out the value of the items contained in the kits (those rows for items contained in kits), and not rows with the kits themselves. How I represent that in Crystal is currently out of my grasp. I'm going to start by trying to do it in SQL (my comfort zone), and will come back to this thread once I have something to show you guys.

Thanks,
//sse Sean Engle
Admin/DirIS
seane@bswusa.com
 
Ok - so - this is what I've come up with. In SQL I am able to get the approximate information I need with the following statement:
-------
SELECT SOP10200.ITEMNMBR, SOP10200.SOPNUMBE, IV00104.ITEMNMBR AS PKGNUMBR
FROM SOP10100, SOP10200, IV00104
WHERE SOP10200.ITEMNMBR IN
(SELECT IV00104.CMPTITNM
FROM SOP10100, SOP10200, IV00101, IV00104
WHERE SOP10100.SOPNUMBE = SOP10200.SOPNUMBE
AND IV00104.ITEMNMBR = SOP10200.ITEMNMBR
AND SOP10200.ITEMNMBR = IV00101.ITEMNMBR
AND IV00101.ITEMTYPE = 3
AND SOP10100.SOPTYPE = 2)
AND SOP10200.SOPNUMBE = SOP10100.SOPNUMBE
AND SOP10100.SOPTYPE = 2
--------
What this derives me is a list of Packages, components of those packages and the salesorder they're attached to. What I need is to be able to report, in Crystal, this information, and be able to zero out the component's value.

Any ideas?

Thanks,
//sse Sean Engle
Admin/DirIS
seane@bswusa.com
 
Create a stored procedure with your select statement in it. Writing scalar subqueries in Crystal is not an option.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top