US and Worldwide: +1 (866) 660-7555
Results 1 to 8 of 8

Thread: Hide few Subreports

  1. #1
    Join Date
    Jun 2009
    Posts
    7

    Default Hide few Subreports

    Hi,

    I have created a report which has 10 sub-reports ,I'm able to select sub-reports using check list, but unable to hide unchecked sub-reports. is there any way to do that ?

    I have designed a report which has 10 sub-report bands one below the other.

    Thanks in advance!
    Ramsagar

  2. #2
    Join Date
    Apr 2007
    Posts
    1,938

    Default

    use the visible style-key to define whether or not the sub-report itself is visible.

  3. #3
    Join Date
    Jun 2009
    Posts
    7

    Default

    Hi,
    Can that be made dynamic? in my case user can select any of those report at run time and rest must be hidden.

    Many Thanks!
    Ramsagar

  4. #4
    Join Date
    Apr 2007
    Posts
    1,938

    Default

    yes, of course it can, just use a parameter to drive visibility, and in the expression for the style key read that parameter.

    something like

    =if([param]="YES";TRUE();FALSE());

  5. #5

    Default

    I am doing something similar. The expression is set for the visible property. I have tested the expression and know that it evaluates exactly as expected but the sub report does not hide.
    Sounds like a bug to me.

  6. #6
    Join Date
    Jul 2008
    Posts
    23

    Default

    I am trying to do same as ramsagar. I understand the visible property. But on which element should that property be set? On the subreport element there is no option for setting the visible property...

  7. #7
    Join Date
    Apr 2007
    Posts
    1,938

    Default

    i did it on the item band within the subreport - obviously thats not ideal as you'd have to put it on all visibile bands inside the report.

  8. #8
    Join Date
    Mar 2003
    Posts
    7,557

    Default

    Banded subreports in Citrus have a bug (PRD-2225) that makes them ignore the visible-flag. They always appear.

    For inline-subreports, the visible flag is evaluated, but you better use Citrus-GA or your hit a bunch of other bugs

    The visible flag is always evaluated in the context of the master-report. So you cannot use this flag to say "if this subreport has no data, dont show it" as visible=false will prevent the report from being run and thus will never actually fire the query.

    Regardless of the subreport type, you can also prevent subreport processing from within the subreport via the "common::subreport-active" attribute. This attribute is evaluated during the report-initialization phase and if the expression evaluates to "false", the subreport will immediately jump to the "report-done" state skipping all processing states in between.

    The "subreport-active" attribute is evaluated within the context of the subreport, after all the data has been queried and all expressions have been initialized. To skip the report if there is no data, you can use the simple "=NOT(ISEMPTYDATA())" formula.

    Note: All of this is only available in PRD-3.5. PRD-3.0 has *no* way to control the subreport's visibility and to achieve a similar result, you would have to add a visible-style-expression to all bands of the sub-report.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •