cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a blank date picker

Former Member
0 Kudos

Hi Everyone,

I was recently asked to write a report which was to feature a from and to date. Additionally I was asked to return all results if no date was stipulated.

Herein lies my efforts, which I am glad to say have been successful!


DECLARE @fromDate DATE, @toDate DATE

SET @fromDate = '[%0]'

    IF @fromDate = '1753-01-01'

        SET @fromDate = '2013-11-01'

SET @toDate = '[%1]'

    IF @toDate = '1753-01-01'

        SET @toDate = GETDATE()

I also declared the variables %0 and %1 as follows.

The key here is the date value of '1753-01-01' which is what Business One will return if a date picker is left empty!

http://stackoverflow.com/questions/3310569/what-is-the-significance-of-1-1-1753-in-sql-server

In my code above I stipulated the date 2013-11-01 if no from date was specified because that was the go live date for our Business One system. Furthermore I stipulated today's date if no to date was stipulated.

I hope that this helps others who may find themselves with similar report requirements.

Kind Regards,

David

Accepted Solutions (0)

Answers (1)

Answers (1)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi David,

Please repost above discussion as question type.

Thanks & Regards,

Nagarajan