Focal Point
[CLOSED] Convert SQL CASE Statement to If Then Else

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6427015826

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,


WebFOCUS 7.6
Windows, All Outputs
February 04, 2013, 03:33 PM
Waz
This 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.


  • Waz...

    Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
    In Focus since 1984
    Pity the lost knowledge of an old programmer!

    February 05, 2013, 10:00 AM
    George Patton
    WTF ???

    Waz - one of the resident true geniouses - goes to all the trouble of replying to the original post and then you delete it ????


    WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
    February 05, 2013, 10:08 AM
    Kerry
    Hi 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


    Kerry Zhan
    Focal Point Moderator
    Information Builders, Inc.