February 04, 2013, 09:30 AM
kumar27[CLOSED] Convert SQL CASE Statement to If Then Else
Hi
Below code is sql code ,i want to convert this to webffocus if then else code
can any one help me
CASE
WHEN MONTH (END_DT) = MONTH (TGT_RUN_FINAL_TS) THEN MONTH (END_DT)
WHEN (TGT_RUN_FINAL_TS) <= [NEXT_DAY [NEXT_DAY [[VALUES TGT_RUN_FINAL_TS - [DAY [TGT_RUN_FINAL_TS) -1) DAYS), 'FRIDAY'),'FRIDAY'))
AND (TGT_RUN_FINAL_TS) > (NEXT_DAY (NEXT_DAY ((VALUES TGT_RUN_FINAL_TS - (DAY (TGT_RUN_FINAL_TS) -1) DAYS), 'FRIDAY'),'FRIDAY')-1 MONTH)
AND (MONTH (END_DT)) <> (MONTH (TGT_RUN_FINAL_TS)) THEN MONTH (TGT_RUN_FINAL_TS-15 DAYS)
ELSE
MONTH (TGT_RUN_FINAL_TS)
END
AS REPORT_MONTH
This message has been edited. Last edited by: Kerry, February 04, 2013, 03:33 PM
WazThis should eb simple.
General Rules.
[LIST]
Add REPORT_MONTH/{format} = to the start
Lose the CASE
Change WHEN to IF
Change =,<=,> etc to EQ LE, GT, etc
Every IF needs a THEN and an ELSE.
Loose the END
Add a semicolon to the end.
If this is in a TABLE FILE you will need the COMPUTE command before it.
February 05, 2013, 10:00 AM
George PattonWTF ???
Waz - one of the resident true geniouses - goes to all the trouble of replying to the original post and then you delete it ????
February 05, 2013, 10:08 AM
KerryHi kumar27,
Please do not delete the content of your original posts. You can make edits as needed, just do not totally remove the content.
I will see if I can recover the original content.
Cheers,
Kerry