Link to home
Start Free TrialLog in
Avatar of mbroad02
mbroad02Flag for United States of America

asked on

Crystal max-date from sub-report

I would like to do the following:

I have a main report which will display certain totals.  Also I need to find certain dates from other tables using sub-reports.  Sub-report: reads table-B.  For every record-type "B" on Table-B, I need to find the latest date from these records.  Then I need to bring this max-date back to the maijn report and print on the group-footer line.
I know how to use shared variable, but I don't know how to store a "maximum date."

Can you help?
Thanks
Avatar of wykabryan
wykabryan
Flag of United States of America image

ok.. so you know the hard stuff.. add date to the detail line, then right click insert summary and choose max at the report foot level. Now, since you know how to do a shared variable. set the shared variable to the report footer max(fieldname).
Avatar of mbroad02

ASKER

Ok, I have done many shared variables, but I was not aware that I could pass the summary value from the footer to another report.   I am trying to do this, but get an error (see attached Word doc) . I place the date in the detail line (hidden) create a summary in the footer for max(date).  Then I create a formula with a shared variable which stores (and passes to main report) the max-date. Am I doing this correctly?
Variable-setup-error.doc
see attached.
Save the date.xls in c:\
save the simple.txt as simple.rpt


date.xls
simple.txt
Thanks Mlmcc. the attachment notes didnt say anything..

mbroad02 see this attachment for the report. It was designed in CR10.
simple.rpt
I have my report formatted as you have suggested, but have a problem (nothing is displaying on main report).  By the way, when I display the data on the subreport, both the MAX field and the formula passing the max to the shared variable display the date.

See attached.

Thank you
Date-Subreport.doc
Avatar of Mike McCracken
Mike McCracken

Where is the subreport?

Is that section suppressed?
If so then the subreport doesn't run

mlmcc
also, you need to have the WHILEPRINTINGRECORD; unsuppressed. This must show up in every one of your shared variable formulas.


SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hmm.. never knew that.. I always do it as practice.. it make sure that it is executed.. Never know when the next patch is going to break something like that..
Folks--No, the subreport is not supressed, I just had it hidden.  The sub-report was working and displaying data.  I saw a comment above saying that my attachment didn't say anything.  I am confused.  Wasn't this helpful in allowing you to understand my problem?   What other documentation would help in debugging this situation?  A report definition?

In your sample, you have nothing but the subreport report-header supressed.  This would cause every line in the sub-report to print, which I don't want.

HELP!
right, i just wanted to show you how to get the subreport max date to the main report. The order of which it is displayed on the main report is important. You must show the subreport then the variable call. If the subreport is in groupfoot1a then the formula must exist in groupfooter1b.
The subreport is located in the main report detail section.  The formula which returns the variable is located in the group footer.  I do this hundreds of times but I can never seem to remember the placement, what can/cannot be supressed/hidden, etc...
Thanks
when using shared variables you can not hid or suppress the subreport.

so how do you get it to appear without making it appear?? unhide it, then go into your subreport and change the color to white. Then get rid of the subreport borders by right clicking on the subreport and format subreport, border tab.  In my example I left the top border for you so you can see where the subreport is..


date.xls
simple.rpt
I understand what you are saying, but there are two issues here:
(1)  No matter how "white" or small I make the subreport, since it reads many date records, if the sub-report is not hidden, it will put a large blank section each time it runs.
(2)  I am NOT hiding or supressing the subreport and it is still not passing the varibale value.

I have attached this report (CR 10).  It is only a start of a report but the fields and subreport of which we have spoken are there.

See what you think.
Thanks
Whoops--forgot to attach the report---here it is-----
Case-Progress-Extract-Dates-0111.rpt
right in the subreport the detail section is being displayed. You can suppress the detail section in the sub as long as it does not contain the shared variable. In my example it takes up very little space on the main report but there is more than 5-6 lines per group.
I truly appreciate your help.  The field is now displaying.  however, as you can see on the attached, since the subreport must read hundreds of detail records to get the max date, the detail section on the main report is a large blank section, which is not acceptable.  how can I have this not show??

Thanks
large-detail-space.doc
did you see my last attachment.. This should take care of it for you.
Yes, in fact the DOC print-screen I just sent was that of your version (had a lot of blank space)...
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
VIOLA!!!!!   Simple but very effective!  thanks so VERY much for all of your asistance!
sure no problem.. easy breeze..
Excellent help.  Went above and beyond!!  A pleasure to have assistance like this!! Thank you!