Passing null values to Date parameter

  • Hi Friends

    This is the situation I am facing.

    I have License Expiry Date Parameter in the report, wrote the condition like this in my data set.

    (lft.Expiry_Date IS NULL OR (lft.Expiry_Date BETWEEN @DTStart AND @DTEnd))

    When I selected null, it’s giving null value records that are fine.

    But when I selected date range it’s giving null values records as well with results.

    I don’t know how to remove null expiry dates records when I selected date range.

    Any help would be appreciated.Please aske me if you need any information.

    Thanks in advance.

  • Add "AND @DTStart IS NULL" before the "OR" and see if that does what you need.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Hi

    Thanks for your time.

    I tried in below 2 ways.

    AND ((@DTStart IS NULL )OR (lft.Expiry_Date BETWEEN @DTStart AND @DTEnd))

    AND ((@DTStart IS NULL AND @DTEnd IS NULL )OR (lft.Expiry_Date BETWEEN @DTStart AND @DTEnd)).

    This time I am not getting null values when I selected null.

    Can you please suggest me?

    Thanks

  • Hi

    I tried in different ways and got the solution finally.

    Solution:

    AND (

    (@Expiry = 'In Range' AND lft.Expiry_Date BETWEEN @DTStart AND @DTEnd)

    OR (@Expiry = 'No Expiry' AND lft.Expiry_Date IS NULL)

    )

    -----------------------------------------------------------------------------------

    Anitha

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply