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

One Sub Report to Many Main Reports

Status
Not open for further replies.

gyfu

Programmer
May 28, 2001
77
HK
Using Crystal Report 9, I am looking for a way to simplify this process, if there is any.

I have one sub-report, group by Days. I have to link this sub-report with various other Main Reports which will have different condition to link the sub-report.Let me try and paint a picture here.
Currently this is how I have it set up :

Subreport 1 : Grp by Acct (Grp by Day)
linking to Grp by Acct Footer in Main Report

Subreport 2 : Grp by Acct2 (Grp by Day)
linking to Grp by Acct2 Footer in Main Report 2

Subreport 3 : Grp by TransitNumber (Grp by Day)
linking to Grp by TransitNumber Footer in Main Report 3

As you can see, I have 3 subreports with different Grouping just so that i can link it to the Main Report. Is there a way, i can just have one Subreport, and link to the Main Report footer accordingly.
Ideally, it will be something like this...giving the same result as above.

SubReport : Grp by *variable* (Grp by Day)
linking to Grp by Acct Footer in Main Report

SubReport : Grp by *variable* (Grp by Day)
linking to Grp by Acct2 Footer in Main Report 2

I hope this is understandable. and perhaps doable. Thanks.

-- gyfu --
 
Groupings aren't dynamic. I don't really follow your question though, it appears that all are linked via a Grp field.

The fact that you're using three subreports within groups is suspect though, I'd go after some architectural suggestions by posting technical information instead:

Crystal version
Databsae/connectivity used (and can you create database objects)
Example data
Expected output

-k
 
Let me try again then, and yes I do suspect it is the architectural of it, but I do not know any other way to do it.

CR Version 9, OLE DB connnection and I use a propietory database.

my subreport looks something like this.

GroupName ({@Day})
in Grp footer {#cntDays} {#TotAmt}

I will have to link this subreport with a few others main reports using some other record selection.What I am doing now is this..

GroupName ({@Acct})
GroupName ({@Day})
in Grp footer {#cntDays} {#TotAmt}

In the Main Report,
I have a group,

GroupName ({@Acct})
in Grp footer1 displayed records in main report.
in Grp footer2 insert subreport.

To my understanding, in order to get the subreport to show the right values from my main report group, I have to link in with the same field. This is the only way I know how to get it to work. However, in this case, I will have a number of similar subreports when I am trying to link with other Main reports.



-- gyfu --
 
It sounds like you're shooting for reusability of a subreport with other main reports.

So I guess your intent is to use the same subreport, and then change the field you link to within the subreport dynamically?

Note that the linking occurs with subreports in the Report->Selection Formulas->Record

I doubt that you can use a shared variable (if the intent is to pass it from the main report), but you might use an If Then to base the link on some condition.

-k
 
You are correct, that is my intent.
So is this not possible?

-- gyfu --
 
You might do so by using a generic IF THEN statement, but Crystal ins't very dynamic by nature, for instance you can't use a fieldname within a formula as a reference.

One would want to do:

@Formula := {table.field}

What you'll get is the value of the field, not the field, so the standard types of dynamic variables used in VB/Fox/most languages aren't available.

-k
 
synapse,
I fail to realized that when CR mean to insert a subreport, it literally means that it will put in the subreport. All this while, I thought that it is just linking or associated only where I have to have the subreport file physically where the main subreport is.

So basically this is a non-issue after all.

Thanks for you help.

-- gyfu --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top