RE: Reporting Period validatetion

  • Hi

    Please I assist, My report has two parameters (StartPeriod and EndPeriod). How do I make sure that the user does not select the EndPeriod that's less than StartPeriod.

    Is there a way I can raise an error to provide a user friendly message?

  • Suggest you examine the T-SQL function DATEDIFF in Books On Line (BOL)

    ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/5cb7105e-c68b-43c2-ab2d-80e525526e27.htm

    Here is a very, very simple bit of T-SQL that will demonstrate the use of the function

    DECLARE @StartDate as DATETIME

    DECLARE @EndDate as DATETIME

    SET @StartDate ='6/20/2009'

    SET @EndDate = '6/02/2009'

    IF DATEDIFF(day,@StartDate,@EndDate) <=0

    BEGIN

    PRINT 'Invalid dates'

    END

    ELSE

    PRINT 'Valid dates'

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • 1. Create a hidden parameter(for eg @Flag).

    2. Set the Falg value based on the SQL mentioned above. Set the Flag to 1 if start date > end date. 0 if start date < end date

    3. Create a text box with the Error Message. Place the textbox on the top of the report.

    4. Set the visibility property of main report table to: If flag=1 then hidden else visible

    5. Set the visibility property of textox to : If flag=1 then visible else hidden.

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

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