Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2016 : Technical Questions
Message Icon Topic: Hide Footer based on Report Section Post Reply Post New Topic
Author Message
Becantor
Newbie
Newbie


Joined: 28 Jul 2017
Online Status: Offline
Posts: 4
Quote Becantor Replybullet Topic: Hide Footer based on Report Section
    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?
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 530
Quote Sastry Replybullet 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
IP IP Logged
Becantor
Newbie
Newbie


Joined: 28 Jul 2017
Online Status: Offline
Posts: 4
Quote Becantor Replybullet 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.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3609
Quote hilfy Replybullet 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
DecisionFirst Technologies - a Proviti Enterprise
9-Time SAP BusinessObjects Partner of the Year.
www.decisionfirst.com
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.