cancel
Showing results for 
Search instead for 
Did you mean: 

Suppress group header when subreport is also suppressed

Uli_Stoeckl
Participant
0 Kudos

Hi,

    

I hope anyone could help me to solve my problem with a report. This report has a main report and a sub report.

 

The main report has a group header for every single project (Detail selection and group footer are suppressed permanently). Within this GH I have placed one sub report.

The sub report shows master data which only exist for character in the sub report.

Further it is suppressed dynamically if one date character > prompt date. This works fine.

                                                                                                                                                                                                                                                            

My problem is now having empty group header. My purpose was to suppress the GH as well when belonging sub report is suppressed.

V.v. if the condition date character > prompt date is false both GH and sub report are shown.

Thanks

Uli

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

May be,a group selection formula written in Reports > Selection Formula > Group would work.

Not sure how the exact condition will look like, but following would be the condition based on your statement "date character > prompt date is false":

date character < prompt date

The condition mentioned above will obviously need to be substituted with the actual database field and the prompt date parameter

-Prathamesh

Uli_Stoeckl
Participant
0 Kudos

Hi Prathamesh,

Hi Abhilash,

the group selection formula regrettably doesn´t work. The reason is:

  • the value for 'prompt date' is transfered from main report to sub report. All needed data for 'date character' does only exist in the data source for the sub report.

Do I need a shared variable if I would use the value of 'date character' as a group selection formula on main report? How should a proper shared variable look like?

Thanks

-Uli

abhilash_kumar
Active Contributor
0 Kudos

You can't use a shared variable in the Group Selection Formula.

How do you Suppress the Subreport?

You should be able to use the same formula to suppress the Group Header 2 as well.

-Abhilash

Uli_Stoeckl
Participant
0 Kudos

Hi Abhilash,

as default it doesn´t work with the same formular to suppress GH2. In the sub report this formular works well, because all value are available.

For the main report (it has another query as a datasoure) the required character does not exist. Therefore this formular (from the sub report) could not retrieve the right values, only '#' is displayed.

Would a shared variable an idea to transfer the formular-value from the sub report to depending project in GH2/main report?

Thanks

Uli

abhilash_kumar
Active Contributor
0 Kudos

You can use a shared variable, however it needs the Subreport to execute first.

So, if you place the Subreport in the Group Header 2, you can only access the value of the shared variable in a section below Group Header 2. It will even work in Group Header 2b.

So you can suppress any section below Group Header 2 using the shared variable but Group Header 2.

Well, if the Subreport is blank for a particular Group and the option 'Suppress Blank Subreport' is checked, then the option 'Suppress Blank Section' for the Group Header 2 should suppress the whole section in my opinion (as long as Group Header 2 has nothing other than the Subreport of course).

Try this:

1) Create a Group Header 2b section

2) Move all fields in Group Header 2a to 2b except the Subreport

3) Set the option 'Underlay following sections' for the Group Header 2a

4) Check the option 'Suppress Blank Section' for the Group Header 2a

5) For Group Header 2b, create a conditional suprpession formula (in the Hide option) with the code below:

shared stringvar variable_name;

variable_name = "";

6) In the Subreport, you would need a shared variable with this code:

shared syringvar variable_name;

variable_name := {string_field};

Let me know how this goes.

-Abhilash

Uli_Stoeckl
Participant
0 Kudos

Hi Abhilash

thanks a lot. This solves my problem. I just had to delete the term

variable_name = ""; within the main report.

Now it works as intended.

Thanks,

Uli

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Ulrich,

Try this:

1) Right-click the Subreport > Format Subreport > Subreport tab > Check 'Suppress Blank Subreport'

2) Go to the Section Expert > Select the section that holds the Subreport (Group Header in this case) > Check the option 'Suppress Blank Section'.

-Abhilash

Uli_Stoeckl
Participant
0 Kudos

Hi Abhilash,

thanks for the very fast answer. First I should mention, that I´m using Crystal Reports for Enterprise. The sub report is in the same section as GH. It looks like:

RH

  GH1 (City/Location)

     GH2 (Project) + Sub report

          Detail (already sppressed)

     GF2 suppressed

   GF1 suppressed

RF suppressed

If I suppress the sub report with the condition (date character > prompt date) there still remains a GH2 with the projectkey (+ descrition and some additional character). My goal is to supress GH2 on the whole when the contition for the sub report is true.

the setting (#1) 'Suppress Blank Subreport'  is already in use.

many thanks in advance

Uli

abhilash_kumar
Active Contributor
0 Kudos

OK. Use the same suppress condition you've used for the GH2 section as well.

So, Right-click the Group Header Section > Select Format Group Header > Click the formula button beside 'Hide' and use the same code you use to suppress the Subreport.

Or as Prathamesh suggests, just create a Group Filter.

-Abhilash