My report goes:
report header suppressed
page header a (contains subreport1 which sets the shared variable showsection to "0" or "1").
page header b suppressed if showsection is 0.
page header c suppressed if showsection is 0.
group header 1 always suppressed.
details suppressed if showsection is 0.
group footer 1 suppressed if showsection is 0.
all other sections suppressed.
The problem is that if showsection is "1" the page headers are showing as designed but the details and the group footer are not showing. I simplified what the subreport is doing for testing and manually change the value to 0 or 1 depending on how I want the test to appear.
Here is my code in the subreport:
whileprintingrecords;
shared numbervar showsection;
showsection := 1
Here is the suppression formula I am using for the page header, group, and detail sections:
whileprintingrecords;
shared numbervar showsection;
showsection =0
Not sure why this matters but when I suppressed the group header this caused the Detail and group footer section suppression formula to evaluate as true. In the section expert I unchecked the Suppression box and instead marked the suppress blank section box instead.
change supression formula like this.
whileprintingrecords;
shared numbervar showsection;
if showsection =0
then true
else false
Related
I've been asked to modify a Crystal Report that has a regulatory statement. When the report is rendered, regardless of the page where the statement is rendered, the given page footer contents must be suppressed. Is there a way to hide the page footer when the regulatory statement is displayed? The statement is an OLE object in Group Footer 3 of the report.
I've created a formula as follows:
WhilePrintingRecords;
booleanVar SuppressFooter := false;
I've placed the formula in the report header, mainly to initialize the variable.
I created a similar formula and placed it in group footer 3 and set the variable to true. I then reference the group footer 3 formula in the Suppress formula of the page footer section expert. Unfortunately, this suppresses the page footer for all pages associated with a given record.
Is there an operand that can be used that states - When group footer 3 is printed, set SuppressFooter:= true? Ideally, I would insert this logic in the Suppress formula of the page footer section expert.
How would I achieve the intended functionality?
Update
It was suggested to move #SuppressFooter to the Group Header 3. It's defined as
WhilePrintingRecords;
BooleanVar SuppressFooter := false;
I also added #SetSuppressFooter to the Group Footer 3. It's defined as:
WhilePrintingRecords;
BooleanVar SuppressFooter := true;
The formula used to suppress Page Footer is defined as:
WhilePrintingRecords;
{#SetSuppressFooter} = true;
Snippets of the report structure are also included:
The above logic is still not suppressing the page footer when Group Footer 3 is rendered.
First, the formula used to suppress Page Footer should be defined as:
WhilePrintingRecords;
BooleanVar SetSuppressFooter;
Then, if your formula #SetSuppressFooter is placed in group footer, it is evaluated even when the group footer is suppressed by condition. I.e. in order to set the variable conditionally (= when the footer is printed) it's not sufficient to place the field within the section, but one must include the logic here:
WhilePrintingRecords;
BooleanVar SuppressFooter;
If {Befehl.showgroup} = 1 Then SuppressFooter := true Else SuppressFooter := false;
You have to replace {Befehl.showgroup} = 1 with your own condition of course, i.e. the one that controls group footer's section visibility.
That leads to one last point: Depending on where the page breaks are located in your report, it could be easier to use the opposite logic for page footer visibility as for group footer visibility. In this case there's no need for "WhilePrintingRecords" formulas.
I have used the following code in a formula in order to count the records:
Shared NumberVar PageofLastField;
If OnLastRecord then PageofLastField := PageNumber;
Also, for page header, I have used the following code in a formula in order to suppress report header if there are no records:
Shared NumberVar PageofLastField;
PageofLastField := PageofLastField;
IF pageofLastfield <> 0 and PageNumber > PageofLastField
THEN TRUE
ELSE FALSE
But still, on the last page, the lines between columns are displayed like a dot (please see printscreen). Can anyone help me? Thanks
Make sure this is not the case with your report.
this happens when you have drawn a line in header section but there is a small portion coming out to the next section. just drag the end point to the same section where the line was started in. This should solve it.
i have problem in crystall report,
Here is my code following many reference site in google,
// {#reset}
//place in group header
whileprintingrecords;
global numbervar Sum_Cumm_Sum:=0;
// {#increment}
//place in section detail
whileprintingrecords;
global numbervar Sum_Cumm_Sum:=Sum_Cumm_Sum+{#getIP};
// {#display}
//place in group footer
whileprintingrecords;
global numbervar Sum_Cumm_Sum;
Where getIP is Formula,
{#sumKN}/{#sumSKS}
and code in it is running total field with reset on change group,
{#sumKN} is running total field for field KN
{#sumSKS} = is running total field for field SKS
============================================================
I use all this code, but in Sum_Cumm_Sum:=Sum_Cumm_Sum+{#getIP}, I can't get the right value.
Here is my report view:
http://i.stack.imgur.com/CSmsB.png
To the extent I see as you placed in detail section your formula is working correctly, Now you want to see the summation of values in footer then you need to write saperate formula to sum index.... in footer section so that it sumarizes it saperatley.
Either use a manual running total OR a running-total field, not both. By the way, a running-total field only works in a footer section.
A better approach:
{#sumKN} - field is {table.KN}; summarize for all records; reset after change in group
{#sumSKS} - field is {table.SKS}; summarize for all records; reset after change in group
// place in `footer` section
//{#ratio}
// optional
// EvaluateAfter({#sumKN});
// EvaluateAfter({#sumSKS});
{#sumKN} / {#sumSKS}
In my Report I am passing the Total of Subreport to display in the Main Report for that I am using the below Formula,
In Subreport,
WhilePrintingRecords;
Shared Numbervar EvTotal:= cdbl({Evaluation_Details.NOOFCOPIESEVALUATED})
In Main Report,
Shared NumberVar EvTotal;
EvTotal;
but when I Include the Formula for displaying in the Main Report it is Dispalying "0" instead of Total of SubReport
A couple of things:
You have some typos in your code. Here you were missing the semi-colon at the end:
WhilePrintingRecords;
Shared Numbervar EvTotal:= cdbl({Evaluation_Details.NOOFCOPIESEVALUATED});
And here you don't need the semi-colon:
Shared NumberVar EvTotal;
EvTotal
And as #Raphael pointed out, 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 "EvTotal" at the end of the first formula, that way you can see what the value is/should be.
The formula that you created in the sub-report must be placed in the detail section or Group header. You can hide this field. Then it will show up the correct value.
I'm trying to suppress all the page footers on the main report on all pages that have a subreport and I'm having some trouble.
The subreport is in the report footer and starts on a new page. The subreport could be 1 or 10 pages so doing it by page number is out.
I've tried setting a global variable in the main report header and setting it to false and then changing the variable just before the subreport section (I change the variable in report footer a, and then the subreport is in report footer b) to true and then tried to suppress the page footer based on that global variable but to no avail.
I feel like I'm really close but just missing something. Any help would be awesome.
Hi Try this it will work
1) Create this formula and place it on the Group Header 2 Section:
whileprintingrecords;
numbervar x := x + 1;
"";
2) Create this formula and place it on the Page Header Section:
whileprintingrecords;
numbervar x := 0;
"";
3) Go to the Section Expert > Select the Page Footer Section > Click the formula button beside 'Suppress' and use this code:
numbervar x = 0;
Let me know how this goes.
You have the right idea, but are probably just missing a detail or two.
In the report footer, create a global boolean variable and then suppress the page footer based on this variable. BUT, you need to use the whileprintingrecords keyword for both formulas. Ex:
//Declare variable in report footer
whileprintingrecords;
booleanvar suppressFooter := true
//Suppress page footer
whileprintingrecords;
booleanvar suppressFooter