Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 288
  • Last Modified:

report within a report

Using CR 8 Developer

We have, for example:

Record 1
Record 2
Record 3
Record 4

Records 1 & 4 can be selected directly but 2 & 3 require a second select based on Record 1. Is this possible ?
0
cehrnow
Asked:
cehrnow
  • 4
  • 4
  • 2
  • +2
3 Solutions
 
cehrnowAuthor Commented:
..or is it possible to run two separate select statements from the same table and merge the results into a single dataset ?
0
 
Kurt ReinhardtSr. Business Intelligence Consultant/ArchitectCommented:
Without knowing your data, a general response is it would be a lot easier if you could just write SQL to return the results you need, but your options with CR8 are extremely limited.  Why are you using such an old version?  Is it because you're support reports in a legacy application?

As to your second question, no you can't run two separate select statements, but you can add the table in twice and join it to itself.  Ex:  Add the "Customers" table, add it again and alias it as  "Customers2" and join Customers2 to Customers on the customer ID.

You might be able to get what you need from the second instance of the table if it's records are based on records from the first table.
0
 
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
You can append two result sets (two SELECT statements using a UNION or UNION ALL statement. But your description is a bit vague, so I don't know what precise logic you are looking for.

You can also insert a linked subreport...
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
cehrnowAuthor Commented:
Apologies using CR 2008 v12 - Developer
0
 
cehrnowAuthor Commented:
Thanks rhinok - have tried this but still not sure it will work out. Best to reorganise db but this is not an option.

Thanks IdoMiller - given that there could be 100s of Record 1s with several Record 2&3 under each one do you still think a sub-report is realistic ?
0
 
Kurt ReinhardtSr. Business Intelligence Consultant/ArchitectCommented:
Is this hierarchical data, such as an employee table where there are children (employees) and parents (supervisors)?
0
 
mlmccCommented:
Can you give a real example of how records 2 & 3 are related to record 1 or 4?
If so a linked subreport can certainly provide access and display of records 2 & 3.

With CR 2008 you can also use a Crystal command to select the records you need.  This command can be fairly complex.  You can also build a stored procedure or use temporary tables to create the desired recordset for the report.

mlmcc
0
 
Kurt ReinhardtSr. Business Intelligence Consultant/ArchitectCommented:
Crystal Reports 8, not 2008.  The only SQL options are to use the Crystal SQL Designer (which I wouldn't recommend, since there won't be any support for it should an upgrade eventually be required) or to use Views/Stored Procs and stored proc support was extremely funky back then.
0
 
mlmccCommented:
Author's comment above

Apologies using CR 2008 v12 - Developer

mlmcc
0
 
Kurt ReinhardtSr. Business Intelligence Consultant/ArchitectCommented:
Ahh, cool.  Missed that, thanks :)
0
 
cehrnowAuthor Commented:
Thanks for all suggestions which I think covers options. However, it's such hard work even with these that I'm forcing through a db redesign.
0
 
vastoCommented:
It is not necessary to redesign the database. This is a classic tree structure and can be easily handled by recursive queries. What is your database type ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now