Crystal Reports: suppress subreport if empty and format parent r

Hi Nigel,
Thanks for the reply. After much educating myself on how Crystal processes reports, I came to the same conclusion. I can't actually pass the record count back up to the main report from an on-demand subreport because it hasn't actually processed until you click the subreport.

What I have without ondemand works so we'll call it a win for now.
Thanks,
Jared

--- In vantage@yahoogroups.com, "NigelK" <nigel.kerley@...> wrote:
>
> Hi Jared,
>
> I don't think Crystal can do what you want. There's no formula button beside the "On-demand Subreport" checkbox, so you can't set a condition there.
>
> Also, because the subreport is "on-demand", until you actually preview it, it hasn't been run and therefore can't calculate your formula 1.
>
>
> Regarding point 3: if I'm putting a subreport with shared variables in, say, the Detail section of the main report, then I would create a second Detail section and put the subreport in the "Details a" and your formula 2 in "Details b".
>
> Alternatively if you put the subreport in a Header (Report/Group) you can then use the variables in Details or a Footer.
>
> HTH,
>
> Nigel.
I am trying to modify a Crystal report that shows open invoices (copied the stock AgdRcv.rpt for now). I want to highlight the background color of a row if it has a memo record. I modified the dataset to bring over the memo table, and the linking happens on InvcHed.InvoiceNum = Memo.Key1. The trick is that InvoiceNum us of a numeric type and Key1 is a string.

My first approach was to create a hyperlink type subreport. So I created a formula field called MemoID as ToText({ARDTLS.InvoiceNum},'#'). Then linked the subreport based on my formuala field. I added a section to embed that report. It kind of works, but now I need some logic to suppress that section if the subreport is null. I'm not sure what to test for.
Thanks,
Jared
Said another way, how can I test from the parent report if the subreport has any records?
You should be able to right-click on the subreport, open Format Subreport... and tick "Suppress Blank Subreport" on the Subreport tab.

You may also have to open the Section Expert (on the main report) and tick "Suppress Blank Section" for that section.



--- In vantage@yahoogroups.com, "k99ja04" <jallmond@...> wrote:
>
> Said another way, how can I test from the parent report if the subreport has any records?
>
Ok that works, but I should have mentioned I wanted to do on demand reports (hyperlink style). Maybe I am swinging too far for the fences, but I want to suppress the subreport hyperlink if the subreport contains no records. The only way I know to do this is to test for count(field)>1 etc. I found some stuff on shared variables on the net, but they are always zero for me.

1.Put this formula in your subreport. You can suppress it from display if you like.

whileprintingrecords;
Shared numbervar SubRecordCount:=(however you want to count the records in the report);

2.Put this in your main report. Again, this can also be suppressed.

whileprintingrecords;
shared numbervar SubRecordCount;
SubRecordCount

3.Use the formula name for #2 for whatever calculations you need.
IMPORTANT: Due to the fundamental logic of Crystal, you can only use this field if it is BELOW it's subreport.
Also, as for counting the records in the subreport, I recommend a running total at the bottom of it.

I don't really understand 3. I know it has to do with the order crystal processes sections, but what qualifies as below? I can function the way things are, but anyone have more experience with shared variables?
Thanks,
Jared


--- In vantage@yahoogroups.com, "NigelK" <nigel.kerley@...> wrote:
>
> You should be able to right-click on the subreport, open Format Subreport... and tick "Suppress Blank Subreport" on the Subreport tab.
>
> You may also have to open the Section Expert (on the main report) and tick "Suppress Blank Section" for that section.
>
>
>
> --- In vantage@yahoogroups.com, "k99ja04" <jallmond@> wrote:
> >
> > Said another way, how can I test from the parent report if the subreport has any records?
> >
>
Hi Jared,

I don't think Crystal can do what you want. There's no formula button beside the "On-demand Subreport" checkbox, so you can't set a condition there.

Also, because the subreport is "on-demand", until you actually preview it, it hasn't been run and therefore can't calculate your formula 1.


Regarding point 3: if I'm putting a subreport with shared variables in, say, the Detail section of the main report, then I would create a second Detail section and put the subreport in the "Details a" and your formula 2 in "Details b".

Alternatively if you put the subreport in a Header (Report/Group) you can then use the variables in Details or a Footer.

HTH,

Nigel.



--- In vantage@yahoogroups.com, "k99ja04" <jallmond@...> wrote:
>
> Ok that works, but I should have mentioned I wanted to do on demand reports (hyperlink style). Maybe I am swinging too far for the fences, but I want to suppress the subreport hyperlink if the subreport contains no records. The only way I know to do this is to test for count(field)>1 etc. I found some stuff on shared variables on the net, but they are always zero for me.
>
> 1.Put this formula in your subreport. You can suppress it from display if you like.
>
> whileprintingrecords;
> Shared numbervar SubRecordCount:=(however you want to count the records in the report);
>
> 2.Put this in your main report. Again, this can also be suppressed.
>
> whileprintingrecords;
> shared numbervar SubRecordCount;
> SubRecordCount
>
> 3.Use the formula name for #2 for whatever calculations you need.
> IMPORTANT: Due to the fundamental logic of Crystal, you can only use this field if it is BELOW it's subreport.
> Also, as for counting the records in the subreport, I recommend a running total at the bottom of it.
>
> I don't really understand 3. I know it has to do with the order crystal processes sections, but what qualifies as below? I can function the way things are, but anyone have more experience with shared variables?
> Thanks,
> Jared
>
>
> --- In vantage@yahoogroups.com, "NigelK" <nigel.kerley@> wrote:
> >
> > You should be able to right-click on the subreport, open Format Subreport... and tick "Suppress Blank Subreport" on the Subreport tab.
> >
> > You may also have to open the Section Expert (on the main report) and tick "Suppress Blank Section" for that section.
> >
> >
> >
> > --- In vantage@yahoogroups.com, "k99ja04" <jallmond@> wrote:
> > >
> > > Said another way, how can I test from the parent report if the subreport has any records?
> > >
> >
>