isames
asked on
Javascript Case Expression
How do you write the equivalent of a SQL Case expression in JavaScript?
Below is what I have so far:
necResult=(QTYCostWithSale sRev_180Da yCOGS*2)/( SERVER_FLD 0000003);
The above code works, but I need to add to the code that says, 'when QTYCostWithSalesRev_180Day COGS is 'blank' or zero, then zero else execute the code above.
Below is what I have so far:
necResult=(QTYCostWithSale
The above code works, but I need to add to the code that says, 'when QTYCostWithSalesRev_180Day
There is no closed replacement, cause CASE in SQL (at least T-SQL) has two different forms..
One is the switch statement. The other form is a cascading if .. else if.
Please define 'blank' in your context.
One is the switch statement. The other form is a cascading if .. else if.
Please define 'blank' in your context.
ASKER
@Ste5an
I mean 0 not blank.
I would you write the SWITCH code?
I mean 0 not blank.
I would you write the SWITCH code?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@isames,
Do you still require assistance with this question? If so post back here, otherwise please can you close the question.
JulianH
Do you still require assistance with this question? If so post back here, otherwise please can you close the question.
JulianH
Open in new window
Basically the same as
Open in new window