COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: nicer on 10 Nov 2014 02:49:46 AM

Title: Help with Filter
Post by: nicer on 10 Nov 2014 02:49:46 AM
I have this SQL - I want to change the dates so the report will run between 30/10 – 10/11/14 instead of yesterday
where do I need to insert the lines ?
Thank you

-- Filter on Projects completed yesterday
and CAST(dbo.F_GetUDFFieldValD(p.projectid, 'ProjectText511') as datetime) >= DATEADD (day, -1, (DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)))
and CAST(dbo.F_GetUDFFieldValD(p.projectid, 'ProjectText511') as datetime) < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)
Title: Re: Help with Filter
Post by: kc9400 on 10 Nov 2014 09:33:42 AM
Quote from: nicer on 10 Nov 2014 02:49:46 AM
I have this SQL - I want to change the dates so the report will run between 30/10 – 10/11/14 instead of yesterday
where do I need to insert the lines ?
Thank you

-- Filter on Projects completed yesterday
and CAST(dbo.F_GetUDFFieldValD(p.projectid, 'ProjectText511') as datetime) >= DATEADD (day, -1, (DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)))
and CAST(dbo.F_GetUDFFieldValD(p.projectid, 'ProjectText511') as datetime) < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)

and CAST(dbo.F_GetUDFFieldValD(p.projectid, 'ProjectText511') as datetime) >= DATEADD (day, -11, (DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)))
and CAST(dbo.F_GetUDFFieldValD(p.projectid, 'ProjectText511') as datetime) < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)

I think changing that should give you the result you want but if you only want it for one run just remember to change it back. I wouldn't make that change if it's in a production/being used by users environment unless they all want to see it.
Title: Re: Help with Filter
Post by: nicer on 10 Nov 2014 10:25:19 AM
thank you