Need Help With a Case Statement (1 Viewer)

krazykasper

Registered User.
Local time
Yesterday, 22:55
Joined
Feb 6, 2007
Messages
35
Based on criteria in FIELD A {SalesOrderPartsSupplies.MaterialId}, I need to replace the value in FIELD B {SalesOrderPartsSupplies.PurchasePrice} with a fixed dollar amount. For some reason my report does not show new dollar amount.
My Case Statement follows:
SELECT {SalesOrderPartsSupplies.MaterialID}
CASE "B525001843"
: {SalesOrderPartsSupplies.PurchasePrice} = 9999.00
CASE "4511100305", "4511100306"
: {SalesOrderPartsSupplies.PurchasePrice} = 660.00
CASE "4511100301", "4511100302"
: {SalesOrderPartsSupplies.PurchasePrice} = 495.00
CASE "4511100300", "4511100015", "4511100020", "4511100027", "4511100037", "4511100045", "4511100055", "4511100068", "4511100077"
: {SalesOrderPartsSupplies.PurchasePrice} = 330.00
 

boblarson

Smeghead
Local time
Yesterday, 20:55
Joined
Jan 12, 2001
Messages
32,059
So Material ID (i.e. B525001843) is a text value and not a number?
 

Mile-O

Back once again...
Local time
Today, 04:55
Joined
Dec 10, 2002
Messages
11,316
You error is that you are trying to place a value into a field, where the result should be of the formula.

i.e. remove {SalesOrderPartsSupplies.PurchasePrice} = from each Case.

Code:
[COLOR="Blue"]Select[/COLOR] {SalesOrderPartsSupplies.MaterialID} 
    [COLOR="Blue"]Case[/COLOR] "B525001843":  9999.00
    [COLOR="Blue"]Case[/COLOR] "4511100305", "4511100306": 660.00
    [COLOR="Blue"]Case[/COLOR] "4511100301", "4511100302": 495.00
    [COLOR="Blue"]Case[/COLOR] "4511100300", "4511100015", "4511100020", "4511100027", "4511100037", "4511100045", "4511100055", "4511100068", "4511100077": 330.00
    [COLOR="Blue"]default[/COLOR]: 0
;
 

krazykasper

Registered User.
Local time
Yesterday, 22:55
Joined
Feb 6, 2007
Messages
35
TO: SJ McAbney

Not sure if I understand you suggestion. The fields "B525001843" are text. The field {SalesOrderPartsSupplies.PurchasePrice} is a numeric, which is where I want the new value (e.g., 660.00). If I remove the field {SalesOrderPartsSupplies.PurchasePrice} from the statement, how it know where to place the numeric amount?

Thanks
 

krazykasper

Registered User.
Local time
Yesterday, 22:55
Joined
Feb 6, 2007
Messages
35
To Bob Larson:

Yes the Material ID is text. The Purchase Price field is numeric.

Thanks,
 

krazykasper

Registered User.
Local time
Yesterday, 22:55
Joined
Feb 6, 2007
Messages
35
Thank You!!

Got it. Thank you very much.
I now realize that after using your solution, I needed to drag the new field onto the report.

Krazy Kasper


SJ McAbney said:
You error is that you are trying to place a value into a field, where the result should be of the formula.

i.e. remove {SalesOrderPartsSupplies.PurchasePrice} = from each Case.

Code:
[COLOR="Blue"]Select[/COLOR] {SalesOrderPartsSupplies.MaterialID} 
    [COLOR="Blue"]Case[/COLOR] "B525001843":  9999.00
    [COLOR="Blue"]Case[/COLOR] "4511100305", "4511100306": 660.00
    [COLOR="Blue"]Case[/COLOR] "4511100301", "4511100302": 495.00
    [COLOR="Blue"]Case[/COLOR] "4511100300", "4511100015", "4511100020", "4511100027", "4511100037", "4511100045", "4511100055", "4511100068", "4511100077": 330.00
    [COLOR="Blue"]default[/COLOR]: 0
;
 

Users who are viewing this thread

Top Bottom