Hi,
I am new to crystal reports. I have a report that users want to run twice a month. When i run on 1st of this month i want to select lasfullmonth data and when i run on 15th i need to pick monthtodate data.
Any help!!!
You can write a stored procedure and in that check for the date… identify where it falls and develop a where criteria logic… Use that condition in your WHERE part in your query or
Write two different queries using IF THEN ELSE branching… only one query gets processed to return the result set.
Another report level solution could be using Date functions / formulae and ‘if then else’ logic in the report filters - selection criteria.
You can also change the filter logic from infoview dependig on the schedule dates.
Hi,
I am sorry to come back again with the same question.
I have a criteria here.
My users want a report to run each week on Monday and Thursday with Month to date data.
Another request is they want it to run on 1st of the month with Last months’s data.
I am using sql server2005.
It’s not working properly when I do it in the record selection formula and they are telling that it’s not good to do it there. They want you to do it in the query itself(command area).
Any help???
Earlier I did like this and it didn’t workout good.
if day(CurrentDate) < 5 then {cmd.date} = LastFullMonth
else {cmd.date} = MonthToDate
I think here what BO_CHief told will work out. I am not understanding where to start.
Another question is If 1st of the month haapens to be monday or Thursday how it’s going to work out.
I created a prameter.
(’{?Period}’=‘Last Full Month’ and DT>=dateadd(mm,datediff(mm,0,getdate())-1,0)
AND DT<dateadd(mm,datediff(mm,0,getdate()),0)
or ‘{?Period}’=‘Month To Date’ and DT>=dateadd(mm,datediff(mm,0,getdate()),0))
Thanks to everybody who keeps on helping others in this forum. It’s really usefull.