Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Shared NumberVar messing up report layout Post Reply Post New Topic
Author Message
Dangoo
Newbie
Newbie


Joined: 13 Jan 2015
Online Status: Offline
Posts: 19
Quote Dangoo Replybullet Topic: Shared NumberVar messing up report layout
    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
IP IP Logged
Erik
Groupie
Groupie
Avatar

Joined: 05 Dec 2013
Online Status: Offline
Posts: 50
Quote Erik Replybullet 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



Edited by Erik - 27 May 2015 at 10:24am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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.
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.