on 07-29-2014 12:07 AM
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
Hi David,
Please repost above discussion as question type.
Thanks & Regards,
Nagarajan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.