Suppress Subreport in crystal reports

1000 views Asked by At

I want to suppress my subreport, if one of the field, used in subreport is empty, so i need the formula for it, actually, now i can able to suppress the subreport based on the fields which are used in main report only, so please provide the solution for it, thanks in advance.

1

There are 1 answers

0
aMazing On

Solution 1: 1) Create a formula in your subreport. which is your condition to hide/show the subreport. Something on the following lines

WhilePrintingRecords;
Shared Stringvar formulaName:= if (condition) then '1' else '0';
 // you can use true /false as well

2) On the main report create another formula

 Shared Stringvar formulaName;
 formulaName

3) Then use this formula to hide the subreport or section on the main report.

Note: it is important that you have the subreport higher in the hierarchy than the formula in the Main Report that calls the variable. I would also suggest to have "WhileReadingRecords;" in both, that way you ensure they evaluate at the same time. Also, as a little debugging help, put "formulaName" at the end of the first formula, that way you can see what the value is/should be.

Solution 2: If that does not work, create a duplicate copy of your subreport and place it on a section above existing subreport and suppress it. Then use solution 1.