This discussion is archived
6 Replies Latest reply: Feb 7, 2013 6:23 AM by GRK RSS

else condition

user9255588 Newbie
Currently Being Moderated
Hi

I have a requirement, for the contact_typ='IA' then I need to display last name of the contact.

I wrote a case statement,

case when contact_typ='IA' then Last_Name End

but when executed in report I am getting

Mike---$100
peter--$200
IN
GF
SR
YT

I am also getting other types of contact_types in the end. For IA type it is displaying names, for other types it is null. But I only want contact_typ 'IA' in my report. Since I dint include else in my statement, I am getting that output, but knowing what to include in the else.Please help me.

Thanks
SARU
  • 1. Re: else condition
    Srini VEERAVALLI Guru
    Currently Being Moderated
    Add a filter on contact_typ='IA' that should avoid other type from report.

    Or else
    case when contact_typ='IA' then Last_Name else 'N' End
    Filter it where <>N

    let me know for issues, if helps mark
  • 2. Re: else condition
    user9255588 Newbie
    Currently Being Moderated
    Thank you!!..But I am looking to filter in backend, rather than in filtering in front end, because when business users pull the report they get confused. Any help is highly appreciated
  • 3. Re: else condition
    Srini VEERAVALLI Guru
    Currently Being Moderated
    In stead of the back end, I would suggest to use logical table source properties content tab->Where clause condition to
    contact_typ='IA'

    If helps pls mark
  • 4. Re: else condition
    user9255588 Newbie
    Currently Being Moderated
    For the other reports I need to use other contact types, so I cannot use contact_typ='IA' in content tab. Thanks!!!!
  • 5. Re: else condition
    Srini VEERAVALLI Guru
    Currently Being Moderated
    Oh is it! then what is backend? you were telling about it in your last message?

    Try out as per my 1st suggestion.
  • 6. Re: else condition
    GRK Journeyer
    Currently Being Moderated
    Hi SARU,

    As per my understanding and the forum - you need display last name for the contact typ -= 'IA'
    And, either you dont want to filter them in logical table source or write a case statement which shows nulls or 'N' and filter by 'N'.

    And, you mentioned that you need it from back end.
    So, Why dont you create another column in physical table (Database).

    Say - I have table employee id, first name, last name, cont type

    Now modify it by creating another extra column - display name

    So, your table changes to employee id, first name, last name , cont type, display name

    Now, based on your condition - update your display name column.

    If, your unable to do that in database. Create a new physical table in physical layer - using select statement.
    And, generate the table Emp Display -- which holds Employee id, Display name. And, display name gets generated by case statement.


    http://allaboutobiee.blogspot.com/2012/03/creating-opaque-view-in-physical-layer.html

    this will definitely resolve your issue.

    thank you.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points