Print Page | Close Window

Shared NumberVar messing up report layout

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=21504
Printed Date: 07 May 2024 at 3:25am


Topic: Shared NumberVar messing up report layout
Posted By: Dangoo
Subject: Shared NumberVar messing up report layout
Date Posted: 27 May 2015 at 3:58am
Hello and thanks for checking out this thread,

I have a super simple report that has a sub-report which is used to generates either a sum of "0" or a value of "1" of greater, based on certain criteria in my database. (I have managed to get this to work, so we can ignore what is going on inside the sub-report)

The whole purpose of the report is if a record generates a value of "1" or greater then the record is suppressed.

To do this I have had to use a Shared Numbervar to extract the value from my sub-report.

I have managed to get the desired results from my report but the layout is completely backwards because as the first image shows I have had to create details b to allow for this to work, and once details b gets suppressed, details a is left on the report (as shown in image 2).

If you take into account the report has to work through 24,876 different records, it leaves a lot of blank space! (take note of the side border entries)





I am not the best with using Shared NumberVar, could you please advise on ways that I can move my sub-report to a more ideal area on my report which still lets my shared numbervar to work?

Many thanks,

Daniel



Replies:
Posted By: Erik
Date Posted: 27 May 2015 at 10:05am
I can't see your image where I'm at so I'm not sure I can fully address what you've described, but here is how I would go about this.

Setup a Counter Formula instead of a sub-report to track your value. It doesn't need to be anywhere in the report, just in the Formulas.
if {table.column} = "value" then 1 else 0

Setup a Group based on a subset that you want to tally the counter for.

Go into Section Expert > Details > Common tab > Suppress (do not check the box) > [x-2]:
if sum({@CounterFormula}, {@Grouping}) = 0 then FALSE else TRUE



Posted By: DBlank
Date Posted: 01 Jun 2015 at 7:42am
in the sub report suppress everything.
set the subreport to run in a section above the shared variable return.
in the main report set the sub report section to be suppressed if the section is blank.
set the shared variable in the main report to be suppressed
in the main report set the section with the shared variable to be suppressed if it is blank.
This will get rid of the blank sections that appear due to sub reports running.
 
a subreport will not run if it is suppressed but you can run it with all of the fields in it suppressed then set the main report section to suppress if that section is blank.
also the shared variable in the main report must exist after/below the subreport section
 
I assume this is the preset report you referred to in your other report but a simpler approach would be to adjust the select process in your data source with a "and not exists" clause.



Print Page | Close Window