Solved

Sorting On Subreport Data

Posted on 2006-11-17
6
827 Views
Last Modified: 2008-02-01
I would like to sort by subreport data.  I have passed a date back from my subreport to my main report using a shared datevar, and put it in a formula.  But Cyrstal doesn't show that formula in my sort expert.  I am using Crystal XI.  Is there a way to sort on information from a subreport?
0
Comment
Question by:AptDev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 200 total points
ID: 17969163
Where is the subreport?  Which section?

I don't know if you can do it or not since I believe the sorting and grouping is done before subreports are run.

mlmcc
0
 

Author Comment

by:AptDev
ID: 17969221
The subreport is in the details section.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 17969277
What is your formula?

mlmcc
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 

Author Comment

by:AptDev
ID: 17969344
Thanks mlmcc... in the subreport I have created two formulas.  

The resetter formula goes in the group header, and it goes like this:

Shared DateVar SortDate := date('01/01/1947');


Then in the detail section of the subreport, I have the max date finder formula like this:

Shared DateVar SortDate;
  if {operation.trans_date} > SortDate then
    SortDate :=  {operation.trans_date};


Then in the main report I have created a formula called Sort_Date that looks like this:

Shared DateVar SortDate;
  SortDate;


The date seems to be passing back and forth in the formulas just fine, it's just that I can't seem to get the sort wizard to recognize or even see the formula to allow me to sort on it.

From the look of things, I'll probably have to rewrite the report without the subreport.  I was just hoping somebody had run into this before and knew a trick I haven't learned yet.
0
 
LVL 26

Accepted Solution

by:
Kurt Reinhardt earned 300 total points
ID: 17975959
1)  Having a subreport in the detail section is a bad idea from a performance perspective. This is because at least one subreport instance will be created and passed as a query to the database for every occurrence of a detail record.  If you have 100 records, you'll have at least 100 subreport queries sent to the DB over your network.  If you have 5K detail records, etc...  There's almost always a better design solution.

2)  You can't sort on a subreport field that's been passed back from the subreport into the main report.

3)  If you're using a SQL-based databaes (SQL Server, Oracle, etc...), then you can create a SQL Expression field in the primary report that returns the date otherwise returned by the subreport.

Are you using a SQL-based DB?

~Kurt
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18098067
Glad i could help

mlmcc
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question