Subreport in group footer,...with union join? 
Author Message
 Subreport in group footer,...with union join?

Hi, i think i've come up against something that simply isnt possible
in Crystal Report (8.5, vb6).  Im wondering if anyone has a work
around or solution, any help will be much appreaciated!!
I need to place a subreport into a group footer. ok, but the problem
is the SQL for this subreport requires a union join, or a few
conditional criteria. Example:

SELECT  *
From nomtrans
Where audit_no    = report.audit_no
AND   ledger_ind    = report.ledger_ind
AND   transfer_ind  = "O"
UNION
SELECT  *
FROM nomtrans
Where  audit_no    = report.audit_no
AND   ledger_ind    = report.class_ind
AND   transfer_ind  = "I"

OR:

SELECT ... WHERE audit_no = report.audit_no
AND ((ledger_ind = report.ledger_ind AND transfer_ind = 'O')
OR (ledger_ind = report.class_ind AND transfer_ind = 'I'))

I wouldn't have a problem creating this report if it wasnt in the
group footer of another report, my normal method would be using ttx
field definition and passing ADO recordset.  This though has me
stumped cos i must link the subreport to the report, and the only way
i know to do this is defining links(?). Any ideas anyone??? Cheers!



Fri, 04 Feb 2005 17:31:33 GMT  
 Subreport in group footer,...with union join?
I don't see any problem here at all. You simply use a linked subreport in
the group footer. You would pass an ADO recordset to the main report, and an
ADO recordset to the subreport.

Of course I don't see why you must use ttx and pass ADO recordsets in the
first place. What you require can be achieved using normal CR with minimal
VB code (really only required to set up connection parameters so that report
can be run against different databases).


Quote:
> Hi, i think i've come up against something that simply isnt possible
> in crystal report (8.5, vb6).  Im wondering if anyone has a work
> around or solution, any help will be much appreaciated!!
> I need to place a subreport into a group footer. ok, but the problem
> is the SQL for this subreport requires a union join, or a few
> conditional criteria. Example:

> SELECT  *
> From nomtrans
> Where audit_no    = report.audit_no
> AND   ledger_ind    = report.ledger_ind
> AND   transfer_ind  = "O"
> UNION
> SELECT  *
> FROM nomtrans
> Where  audit_no    = report.audit_no
> AND   ledger_ind    = report.class_ind
> AND   transfer_ind  = "I"

> OR:

> SELECT ... WHERE audit_no = report.audit_no
> AND ((ledger_ind = report.ledger_ind AND transfer_ind = 'O')
> OR (ledger_ind = report.class_ind AND transfer_ind = 'I'))

> I wouldn't have a problem creating this report if it wasnt in the
> group footer of another report, my normal method would be using ttx
> field definition and passing ADO recordset.  This though has me
> stumped cos i must link the subreport to the report, and the only way
> i know to do this is defining links(?). Any ideas anyone??? Cheers!



Fri, 04 Feb 2005 17:49:13 GMT  
 Subreport in group footer,...with union join?
Tankx for such a speedy reply.
First off im using the old ttx method because the original report
requires several outer joins. Our product supports both informix and
SQLserver Databases and so the SQLs differ between databases, after a
few brief tests i concluded crystal wasnt going to handle this. Also
im using the report to display several different reports.  These
things however arent relevant to my current dilema.
The problem with the linked subreport is the linking. The subreport RS
will be returning from the table all where transfer_ind IN("O", "I")
and audit_no is say 69. Then for each group, linking with ledger_ind.
Thats all ok, but i need the records where:

 ((ledger_ind = report.ledger_ind AND transfer_ind = 'O')
 OR (ledger_ind = report.class_ind AND transfer_ind = 'I'))

This conditional linking does not appear to be possible using the
linking expert.  

Have i missed a trick?

Cheers
Dunc.

On Mon, 19 Aug 2002 19:49:13 +1000, "CW"

Quote:

>I don't see any problem here at all. You simply use a linked subreport in
>the group footer. You would pass an ADO recordset to the main report, and an
>ADO recordset to the subreport.

>Of course I don't see why you must use ttx and pass ADO recordsets in the
>first place. What you require can be achieved using normal CR with minimal
>VB code (really only required to set up connection parameters so that report
>can be run against different databases).



>> Hi, i think i've come up against something that simply isnt possible
>> in crystal report (8.5, vb6).  Im wondering if anyone has a work
>> around or solution, any help will be much appreaciated!!
>> I need to place a subreport into a group footer. ok, but the problem
>> is the SQL for this subreport requires a union join, or a few
>> conditional criteria. Example:

>> SELECT  *
>> From nomtrans
>> Where audit_no    = report.audit_no
>> AND   ledger_ind    = report.ledger_ind
>> AND   transfer_ind  = "O"
>> UNION
>> SELECT  *
>> FROM nomtrans
>> Where  audit_no    = report.audit_no
>> AND   ledger_ind    = report.class_ind
>> AND   transfer_ind  = "I"

>> OR:

>> SELECT ... WHERE audit_no = report.audit_no
>> AND ((ledger_ind = report.ledger_ind AND transfer_ind = 'O')
>> OR (ledger_ind = report.class_ind AND transfer_ind = 'I'))

>> I wouldn't have a problem creating this report if it wasnt in the
>> group footer of another report, my normal method would be using ttx
>> field definition and passing ADO recordset.  This though has me
>> stumped cos i must link the subreport to the report, and the only way
>> i know to do this is defining links(?). Any ideas anyone??? Cheers!



Fri, 04 Feb 2005 18:26:54 GMT  
 Subreport in group footer,...with union join?
On your problem first:

There is nothing to stop you from utilizing a shared variable, and use that
variable in report selection formula in the subreport, instead of using
links.

The idea is simple - you pass report.ledger_ind (I assume that's from your
main report) to the subreport via a shared variable. In the subreport, the
record selection formula would make use of the shared variable.

Now in terms of supporting multiple backend databases, I think the easiest
way is to use SetSQLQuery method to set SQL query passed to the database
depending on the type of database you are dealing with. I personally find it
a lot more managable than having to use ttx file and set recordset
dynamically at run time. I have used this method to change a report data
source from a desktop database to SQL Server/DB2 without any issue. Anyway,
that's just my 0.02 c.


Quote:
> Tankx for such a speedy reply.
> First off im using the old ttx method because the original report
> requires several outer joins. Our product supports both informix and
> SQLserver Databases and so the SQLs differ between databases, after a
> few brief tests i concluded crystal wasnt going to handle this. Also
> im using the report to display several different reports.  These
> things however arent relevant to my current dilema.
> The problem with the linked subreport is the linking. The subreport RS
> will be returning from the table all where transfer_ind IN("O", "I")
> and audit_no is say 69. Then for each group, linking with ledger_ind.
> Thats all ok, but i need the records where:

>  ((ledger_ind = report.ledger_ind AND transfer_ind = 'O')
>  OR (ledger_ind = report.class_ind AND transfer_ind = 'I'))

> This conditional linking does not appear to be possible using the
> linking expert.

> Have i missed a trick?

> Cheers
> Dunc.

> On Mon, 19 Aug 2002 19:49:13 +1000, "CW"

> >I don't see any problem here at all. You simply use a linked subreport in
> >the group footer. You would pass an ADO recordset to the main report, and
an
> >ADO recordset to the subreport.

> >Of course I don't see why you must use ttx and pass ADO recordsets in the
> >first place. What you require can be achieved using normal CR with
minimal
> >VB code (really only required to set up connection parameters so that
report
> >can be run against different databases).



> >> Hi, i think i've come up against something that simply isnt possible
> >> in crystal report (8.5, vb6).  Im wondering if anyone has a work
> >> around or solution, any help will be much appreaciated!!
> >> I need to place a subreport into a group footer. ok, but the problem
> >> is the SQL for this subreport requires a union join, or a few
> >> conditional criteria. Example:

> >> SELECT  *
> >> From nomtrans
> >> Where audit_no    = report.audit_no
> >> AND   ledger_ind    = report.ledger_ind
> >> AND   transfer_ind  = "O"
> >> UNION
> >> SELECT  *
> >> FROM nomtrans
> >> Where  audit_no    = report.audit_no
> >> AND   ledger_ind    = report.class_ind
> >> AND   transfer_ind  = "I"

> >> OR:

> >> SELECT ... WHERE audit_no = report.audit_no
> >> AND ((ledger_ind = report.ledger_ind AND transfer_ind = 'O')
> >> OR (ledger_ind = report.class_ind AND transfer_ind = 'I'))

> >> I wouldn't have a problem creating this report if it wasnt in the
> >> group footer of another report, my normal method would be using ttx
> >> field definition and passing ADO recordset.  This though has me
> >> stumped cos i must link the subreport to the report, and the only way
> >> i know to do this is defining links(?). Any ideas anyone??? Cheers!



Fri, 04 Feb 2005 19:08:41 GMT  
 Subreport in group footer,...with union join?

Ah-har,like it! Im a bit new to crystal so still finding my way
everytime i have to do something a bit different. Dont find the help
much good.
Cheers for your 0.02c much help!!

Dunc.



Fri, 04 Feb 2005 20:28:52 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Subreport in group footer overlaying group header

2. Repeat Group Footer in Report Footer

3. Page footer and Group footer

4. Union query + subreport = Slow

5. SQL Genius Required! UNION with INNER JOIN

6. UNION or OUTER JOIN

7. Subreport in page footer

8. Footer and Header in Subreports

9. Page Footers In Subreport

10. Page Footer in Subreport?

11. Page Header/Footer in subreport

12. Page footer subtotals for subreports

 

 
Powered by phpBB® Forum Software