Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter crystal report

Status
Not open for further replies.

swetham

Programmer
May 5, 2010
257
DE
Hi,
I have a report which is generated acoording to the week number given in vb.net. I claculated the startdate and enddate from the week number in vb.net and passed those variables to crystal reports. Now i want the reports for "This week", "Last Week", "This Month"," Last Month". My doubt is whether i have to create four reports seperately or is there any way such that i can filter in one report itself?

Thanks,
Sweish.
 
Assuming your Startdate is the first day of the week, your current date range covers this week.

You can then use formula to calculate Last week

Function dateadd will allow you to subtract 7 days

This month will require you to calculate 1st of month

Date(Year(startDate), Month(startDate), 01)

From that you can then determine last month

last day = Date(Year(startDate), Month(startDate), 01)-1

Firts day again using dateadd to subtract 1 month from
Date(Year(startDate), Month(startDate), 01)

Ian
 
my doubt is in the report where will be the option for user to select like "This month report","LAst month report
 
YOu must use a String Parameter and add the defaults

"This week", "Last Week", "This Month"," Last Month".

In your select filter

(If {Paramter} = "This week" then date in start to end else

If {Paramter} = "Last week" then {formula for first day last week} to {formula for last day last week}
else

.....)

Ian
 
Excuse me for asking such a easy question, How should i add a string parameter? where should i add it? In what way it will be visible by user? How will the user select these four options?
 
I have added a string parameter "Options" with 4 values "This week", "Last Week", "This Month"," Last Month". "show on viewer panel":read-only. Default value: This week. How should i use this in vb.net apllication? In crystal reportviewer of .net users will be viewing the reports . There in the report how can i give option to user to select?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top