Monday, February 29, 2016

Crystal Reports : Linking a Subreport

Once your subreport has been embedded, it can be then linked. If the subreport has nothing to do with the main report, data-wise, then leave this part alone.

However, if the subreport has parameters, we must decide what to do with them. Because if you leave them unlinked, the end user is prompted for them alongside the parameters for the "main" report.


The idea is to select a parameter from the "Available Fields" list, add it to the right side and then select the subreport parameter it should be linked to. This way, the end user (in this case) is only prompted for one date range instead of two.

A few considerations;

1. The data types in the main and subreport(s) must be identical when Linking, otherwise they won't show in the drop down. This literally just happened to me a moment ago when producing this screenshot. 

2. Do yourself a favor and name your parameters consistently. In this example, the Date_Range parameter from the main is linked to the Date_Range parameter in the sub. 

3. If there is no corresponding parameter in your subreport, you can try using the "Select data in subreport based on..." checkbox. Results vary. If you're willing to embed a subreport, go the entire distance by creating matching parameters.

And as ALWAYS keep backups. 


Erin Nino said...

I am really enjoying the theme/design of your web site.
Do you ever run into any browser compatibility issues?
A few of my blog readers have complained about my website
not working correctly in Explorer but looks great in Chrome.
Do you have any tips to help fix this issue?

CrystalFriend said...

Another reason I like subreports (aside from fewer parameters to enter) is the performance benefit. I notice if I have multiple custom datasources and I am unable to create one query for it, a subreport is a nice way to divvy up the processing. It seems faster to use a subreport than joining two custom data sources sometimes.

aliya seen said...

The professional company profile design are not difficult to build. There are lot of platform that are providing these services free.