• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 718
  • Last Modified:

Dynamically Moving Report Objects if SubReport Suppressed

Hi,

I hope i am asking a question which has a very simple answer, but for all my trying i dont seem able to find it.

I want to put a subreport into the Report Footer alongside an existing chart object (so that the subreport is to the left of the chart). Ideally i would really like to have the subreport in the same section as the chart.

This works well if the subreport contains data - the report looks neatly formatted.

However if the subreport does not contain any data i would like to suppress it and then move the chart object across to cover the entire space of the report footer (else the report has a silly blank space in it).

Does anybody have any ideas on how to achieve this ? - all i want to do is say 'if the subreport is suppressed then resize the chart to cover the bigger space'

Many thanks in advance for your help.


0
wilkinsg
Asked:
wilkinsg
  • 3
  • 3
  • 2
  • +1
2 Solutions
 
frodomanCommented:
What I would do is to create two charts - a full size one and a half size one and put them in different report footer sections.  If the subreport is suppressed then suppress the entire report footer a and don't suppress report footer b (containing the full size report).  If the subreport isn't suppressed then do the opposite.
0
 
wilkinsgAuthor Commented:
Sounds like it should work nicely.

One question thou' - How do i suppress the entire report footer/not the other one if the subreport is to be suppressed ?

Thanks

0
 
mlmccCommented:
That is probably the best way to do it.  Trying to resize an object would be difficult at best.

mlmcc
0
Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

 
ladylinetCommented:
Which version of Crystal? In version 9, you can say on subreport itself to suppress if blank, in previous versions that was impossible.
 And you can put subreport in separate section, and suppress section if blank also.
 SubReport can return shared variable that will notify main report that it should unsuppress other one...

Lady Linet
0
 
wilkinsgAuthor Commented:
It is version 9.

Sounds like creating 2 separate sections and then suppressing one or the other based upon the supreport sounds like the way to go.

But i am not sure how to suppress the subsections based on the subreport suppression value.

Lady Linet you mentioned that it is possible to use a shared variable to notify the main report - could you please expand upon this ?

Many Thanks
0
 
ladylinetCommented:
In subreport, create formula field and put something like this in it:

 Shared blnNoData As Boolean

 IF Not(Isnull(Count({Report1.ID}))) or Count({Report1.ID}) > 0 Then
  blnNoData = True
Else
 blnNoData = False
End IF

 where Report1.ID is field that you are expecting to exist

In main report create another formula on suppress, and put something like this:
 Shared blnNoData As Boolean
 If blnNoData = True Then
  formula = True '-- hide
Else
  formula = False ' -- show
End IF

HTH,
Lady Linet
 
0
 
frodomanCommented:
Lady Linet's implementation is similar to what I was thinking on the first post.  Maybe a couple things you can simplify if you want though.

In the subreport you can simply use this formula in the report footer:
       OnFirstRecord and OnLastRecord and RecordNumber<>1

There's nothing wrong with LL's approach - this one is more portable and can be used on any subreport regardless of the data fields.

For the suppression formula you can simply use: bInNoData

Since this value is already true or false there's no need to run it through an if/then statement.
0
 
ladylinetCommented:
Hi frodoman, are you sure that RecordNumber is working? When I've tried it, I've got 1 even for empty (main) report ...
 And for If/Then, it's just more readable for me that way.

Thanks,
Lady Linet
0
 
wilkinsgAuthor Commented:
Many thanks for all your help - i now think i can produce the report exactly as i need it.

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now