Case Statements

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anishap
    New Member
    • Oct 2007
    • 2

    #1

    Case Statements

    Can anyone help me with the case statements?
    I have customized a new report for our application (vendor software). I want the end user to check 3 boxes to print (they can choose all or one or two).

    Below is the case statement I tired in the where clause

    Where
    STATUS = CASE
    WHEN REPORT.SEPARATE D = 'y' THEN 'S'
    WHEN REPORT.TERMINAT ED = 'y' THEN 'T'
    WHEN REPORT.RETIRED ='y' THEN 'R'
    END

    I want the user to check one box , two or 3 . Rightnow it is working fine if any one option is checked. Please let me if there is any other way to do this.

    many thanks
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by anishap
    Can anyone help me with the case statements?
    I have customized a new report for our application (vendor software). I want the end user to check 3 boxes to print (they can choose all or one or two).

    Below is the case statement I tired in the where clause

    Where
    STATUS = CASE
    WHEN REPORT.SEPARATE D = 'y' THEN 'S'
    WHEN REPORT.TERMINAT ED = 'y' THEN 'T'
    WHEN REPORT.RETIRED ='y' THEN 'R'
    END

    I want the user to check one box , two or 3 . Rightnow it is working fine if any one option is checked. Please let me if there is any other way to do this.

    many thanks
    i think this would be better if you build the WHERE from your form/gui. you have might have to adjust the returned value of your checkbox. depending on your front-end tool.

    something like

    queryvar = queryvar + ' WHERE STATUS IN ('
    for counter = numbercheckbox
    if checkbox is checked
    queryvar = queryvar + returnedvalueof checkbox

    queryvar = queryvar + ')'

    this is a psedocode. am suggesting the technique, not the syntax. depending on your gui, you're going to have to adjust it accordingly

    Comment

    Working...