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!

changing date in 16 subreports in 1 or 2 steps

Status
Not open for further replies.

pieter12

Technical User
Sep 30, 2002
4
NL
Hello People,

I have a report with 8 subreports (don't ask me why i just do:).all the data is selected on lastfullweek. if i want to change the date to last full month i have to edit all subreports and changing it in select expert. is there a easier way to get this done, i tried parameter's and change subreport links but they didn't gave me the result i wanted .

Wot i want is a date selector daily,weekly,monthly for all my subreports in 1 click

Can some1 pls push me into the right direction
 
Here's how I do this exact thing:

Build 2 formulas to house the start and end dates.

Use a prefilled parameter in the main report which populates these 2 formulas based on the user selection (such as Last Week, Last Month, etc), and set the links from these formulas to the appropriate date fields in your subreports.

Here's an example of my subreports record selection criteria:

({SOL_VW_RPT_IDLE_REASON_SUM.LOCALTIME} >= {?Pm-@Date Range Start}
and
{SOL_VW_RPT_IDLE_REASON_SUM.LOCALTIME} <= {?Pm-@Date Range End})

Now populating the Date Range Start and Date Range End is quite an ordeal, especially if you want to make sure that the SQL is passed to the database, but once it's in place, it's a great user experience, and it works perfectly.

Be careful when using the Crystal supplied functions, such as lastfullmonth, they may not pass SQL, just construct the dates for the formulas yourself.

So one parameter, which is a daterange, and the formulas are used by the record selection formula in the main and all subreports.

-k kai@informeddatadecisions.com
 
Dear Synapsevampire,

I tried your example but im still struggle with it for day's, I've made 2 parameters start date and end date both are linked to browse table esapor and browse field st_dat_ser.

I've made 2 formula's
{Esapor.st_dat_ser} = {?startdate}
{Esapor.st_dat_ser} = {?enddate}

I have to following in my select expert in main report
{Esapor.st_dat_ser}> = {?startdate}
{Esapor.st_dat_ser}< = {?enddate}

If i put this in the subreport select expert it gives the error this field is unknown.(i know its not there or not linked)

Everything works fine in the main report.
You said link the formula's to the subreport. My problem is i can't choose subreport field because it's empty i can only chose the subreport and the subreport table if i run the report the 2 links are gone.

Where do i go wrong ?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top