cancel
Showing results for 
Search instead for 
Did you mean: 

Formula for indicating whether or not subreport is suppressed

Former Member
0 Kudos

Hi,

The structure of my main report depends on whether or not a subreport is suppressed.  If it is suppressed, I need a field on my main report in a different place. 

The solution I've adopted is to pass a boolean variable from my subreport back to the main report.  The formula in my subreport looks something like this:

Shared BooleanVar isResults;

If Count ({MyData.FieldName}) > 0 Then
    isResults = True
Else
    isResults = False

The subreport is structurally very simple.  Report Header, Details, Report Footer.  The Details contain the records that populate this subreport if there are any.  I've placed the Count summary in the Report Footer.  The formula above is also in the formula.

For some reason, this formula is not working correctly.  It invariably returns False.  If I have two records, and my Count field shows a value of 2, why would my formula return False?

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Peter,

Does the formula show 'False' in the Main Report or Subeport?

Here's an alternative:

Modify the formula to check if a field is null instead:

Shared BooleanVar isResults;

If isnull({MyData.FieldName}) Then
    isResults = False
Else
    isResults = True

Place this formula on the Report Header.

-Abhilash

Former Member
0 Kudos

Abhilash,

I tried changing my formula to what you have in your post.  I moved the formula to the rport header of my subreport.  Unfortunately, I'm only getting "False" values even when there should be records in the subreport.

Answers (4)

Answers (4)

Former Member
0 Kudos

I believe I've discovered my problem.

The formula is assigning values to the variable with "=".  I changed it to ":=" and the shared variable is evaluating to the correct boolean value now. 

Thank you for your help.

Former Member
0 Kudos

Unfortunately, none of these solutions seem to be working.  Does anyone know of a simpler way to accomplish my goal?  Basically, I want to show/suppress a couple of fields on my main report based on whether or not a subreport is blank.  Is there a more obvious solution that I'm passing over?

Thanks.

Former Member
0 Kudos

Hi

I created a report and by changin 'Default values for Nulls' option it is working fine at my end.  Is there a way you can attache your .rpt file to this form ?  I don't know whether you can attache it or not. if you can please attache your report.

Thanks,

Sastry

Former Member
0 Kudos

The count summary must PRINT in your subreport, it can be white text, but it must print in order to pass the value to the main report.

Then the shared formula in the main report must be in the main report after the subreport in order for it to get the value from the subreport.

Debi

Former Member
0 Kudos

Hi

Please check in which section of your main report contains this formual and also where your sub report placed in your main report.   If you place this formula any of the section which is below of this formula it will not work, because it will not get processed.

Hope this helps.

Thanks,

Sastry

Former Member
0 Kudos

Sastry,

The subreport is in Group Header 2a of my main report.  Group Header 2b outputs the shared variable value.

In the subreport, the formula which assigns the shared variable is in Report Footer below the details.

Former Member
0 Kudos

Hi Peter..

I got it.  It is because there is a null value in your sub report so, it is not processing it.  Go in your sub report edit your formula --On top of your formula editor there is a drop down with Exceptions for Nulls make it 'Default Values for Nulls' and save.

It works...

Thanks,

sastry

Former Member
0 Kudos

I tried this with my formula as well as Abhilash's.  Unfortunately, it doesn't make a difference.