Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

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
0
mbroad02
Asked:
mbroad02
  • 12
  • 10
  • 2
2 Solutions
 
wykabryanCommented:
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).
0
 
mbroad02Author Commented:
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
0
 
wykabryanCommented:
see attached.
Save the date.xls in c:\
save the simple.txt as simple.rpt


date.xls
simple.txt
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
wykabryanCommented:
Thanks Mlmcc. the attachment notes didnt say anything..

mbroad02 see this attachment for the report. It was designed in CR10.
simple.rpt
0
 
mbroad02Author Commented:
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
0
 
mlmccCommented:
Where is the subreport?

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

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


0
 
mlmccCommented:
Actually that isn't required.  Any formula with a Shared variable is automatically set to WhilePrintingRecords pass.

I always use it to simply document it.

mlmcc
0
 
wykabryanCommented:
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..
0
 
mbroad02Author Commented:
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!
0
 
wykabryanCommented:
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.
0
 
mbroad02Author Commented:
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
0
 
wykabryanCommented:
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
0
 
mbroad02Author Commented:
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
0
 
mbroad02Author Commented:
Whoops--forgot to attach the report---here it is-----
Case-Progress-Extract-Dates-0111.rpt
0
 
wykabryanCommented:
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.
0
 
wykabryanCommented:
0
 
mbroad02Author Commented:
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
0
 
wykabryanCommented:
did you see my last attachment.. This should take care of it for you.
0
 
mbroad02Author Commented:
Yes, in fact the DOC print-screen I just sent was that of your version (had a lot of blank space)...
0
 
wykabryanCommented:
heheh.. right..

insert new section in the group footer. then drag the groupfooter b above groupfooter a (this will reduce the time of dragging and dropping each column). Then move the subreport into groupfootera. suppress detail line.
0
 
mbroad02Author Commented:
VIOLA!!!!!   Simple but very effective!  thanks so VERY much for all of your asistance!
0
 
wykabryanCommented:
sure no problem.. easy breeze..
0
 
mbroad02Author Commented:
Excellent help.  Went above and beyond!!  A pleasure to have assistance like this!! Thank you!
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

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