Print Page | Close Window

Hide Footer based on Report Section

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22407
Printed Date: 28 Apr 2024 at 1:27pm


Topic: Hide Footer based on Report Section
Posted By: Becantor
Subject: Hide Footer based on Report Section
Date Posted: 08 Aug 2017 at 10:24am
Have a scenario where there is a main report with an embedded sub report (which can be a varying lengths). Trying to find a way to NOT show the footer (page count) on the sub report pages and then continue again on the main report. I can't just use Suppress where PageCount=page number because the sub report could 1 page or 5 pages long.

Rough Outline of report is
Report Header
Page Header
Group 1
Details Aa
Details Ab
Details Ac (Sub Report)
Details Ad
Group 1
Page Footer.

Is there a way to have the footer suppress where the Report section equals Details Ac?



Replies:
Posted By: Sastry
Date Posted: 08 Aug 2017 at 5:25pm
Hi

Create a formula and place it in Details Ac where sub report prints on the main report like:

Flag = 'y'

Now create one more formula like :

Flag ='n' // Place this formula in Details Ad

Now right click on page count --Format-- suppress and say

If flag = 'y' then true else false



-------------
Thanks,
Sastry


Posted By: Becantor
Date Posted: 09 Aug 2017 at 11:32am
Thanks, but this doesn't seem to work.

Issue 1) When I create a formula and type " Flag='y' " and try to save, it says 'there is an error in the formula'.

So I went ahead and just saved the formula (@PageFlag_Yes) with simply " 'y' "

Did the same thing for the No flag

Issue 2) I went to the footer and said to suppress if {@PageFlag_Yes)='y'. Now it suppress the footer for All pages.

@Yes was placed on the Details Ac line (next to the sub report).

@No was placed on Details Ad section and hidden.


Posted By: hilfy
Date Posted: 10 Aug 2017 at 6:57am
What Sastry didn't mention is that you need to create a variable to do this. So, your formulas would look something like this:

{@Flag_Yes}
stringvar flag := 'y';
' '

{@Flag_No}
stringvar flag := 'n';
' '

(the last line with the blank string is there so that noting appears on the report when you use this.)

Variables have to be declared in every formula where they're used. Using them like I show above, without any modifier (e.g., Local, Shared, Global) makes them Shared so that they will share values in all places in the "report" where they're declared (Main report OR subreport, but not between the two...)

Your suppression formula will then change to this:

stringvar flag;
flag = 'y'

You'll notice a couple of things here. In the first two formulas I used ":=" to set the value. When using variables, you use ":=" to set the value and "=" to compare. You'll also see I didn't use an "If..Then" structure here. If an expression evaluates to true or false, it is redundant to use "If .... then true else false", you can just use the expression itself.

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window