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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subreport link not working

Status
Not open for further replies.

kskid

Technical User
Mar 21, 2003
1,767
US
Crystal 8.5 on Oracle 8i Database.

I must be missing something.

On one Main report, the subreport is successfully linking and providing me with the necessary data. However, in another main report, the same parameter links on the same subreport is coming up empty. I've double checked the Change Subreport links and they are identical.

There are two parameters

RMo for Report Month Number (1 - 12)
RYr for Report Year Number (2003,2004,etc)

From the parameters, I created 2 formulas

@DtFrom
dateserial(year{?Ryr},Month({?RMo),1)

@DtTo
dateserial(year{?Ryr},Month({?RMo)+1,1)

I create subreport links

@DtFrom subreport parameter to use ?PM-@DtFrom
@DtTo subreport parameter to use ?PM-@DtTo

select data in subreport based on fields is unchecked

The subreport Select Expert has

{DISPATCH.CLOSE_DATE} in {?Pm-@DtFrom} to_ {?Pm-@DtTo}


While the subreport is in the report footer on the 1st main report, it's in the report header on the 2nd main report but even after moving it in the other sections, I still draw a blank.

There has to be some report option I am missing?

 
A few problems here:

@DtFrom
dateserial(year{?Ryr},Month({?RMo),1)

@DtTo
dateserial(year{?Ryr},Month({?RMo)+1,1)


For the month of December you'll pass 13 as the month(?rmo)+1 and blow up, try:

@DtTo: dateadd("m",1,{?Ryr})

Next, don't use parameters in the subreport, and turn on the select data in subreport based on fields, and just link the main report parameter to the subreport field (assuming that the parameter is also used by the main report).

Last, check the subreport record selection formula to assure that it contains what you want, someone may have edited it, or Crystal may have gotten confused.

-k
 
That's the beauty of dateserial(), it automatically adjusts the months and year unlike date().

As for the subreport, I have to pass a date range (@DtFrom and @DtTo) because I am returning a summary count only.

Still can't figure out why it works on one report but not another.

My other option is to create shared variables but will the dates show up in my Show SQL query. I guess I'll find out.
 
Got it working. Apparently, you have to use the formula in the main report before you can link it to the subreport.

In this particular case, I am using the Main report as basically a dummy report where I include all of my monthly measurement reports as subreports.

I did have to run 35 individual Crystal Reports, followed by the users doing the printing, collating and mailing them. Now I only run 3, each with about 12 subreports each. A lot easier to print and collate.

Is there a limit on the number of subreports that can go into a main report?


 
Ahhh, right, thanks. I forgot about the dateserial, I've been doing it the old way for too long.

You didn't understand my point about using a link oif the fields in the main to fields in the sub (as opposed to linking to parms in the sub).

Use what formula in the main report, the dates? Are you saying that the subreport didn't force a prompt of the Main parameters even though it had a dependency in the sub record selection?

Weird...

I've seen over 15 subreports in a Main report (I redesigned it down to 1 subreport though). Make sure that you keep copies of the report though, the more subreports, the more the likelihood of corruption.

Odd that you need that many subreports, is this because you don't have access to creating Views/SP's?

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top