Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2006
    Utrecht, Holland

    Unanswered: Conditionally displaying subreports in Crystal Reports 8.5


    I am pretty new to Crystal Reports 8.5. I have tried out CRXI trial version and there is an option to create formatting formulas.

    This is really good, as we want to create a "super" report which contains the content of many of our individual reports. I have created a small test program in Borland Developer Studio (C++) which sets some boolean parameters that are available in the main "super" report which describe which sub-reports are to be included.

    What I would like to do is say if one of the parameters equals true, include the appropriate individual report. However, this seems to be quite difficult in 8.5. With version XI trial I can do this with a Formatting Formula, but we do not have the full version of XI and I would like to accomplish the same functionality with 8.5 if I can.

    Any help is greatly appreciated!

  2. #2
    Join Date
    Aug 2006
    Crystal Reports 8.5 does have a means to apply conditional formatting to objects and sections. But, it's by using the tools provided by Crystal, not through code, except for some minimal Crystal Syntax or Basic logic. If you get familiar with the tools, functions and shortcuts, you can fly through a complicated report fairly quickly.

    I would suggest inserting additional sections for each sub-report if they occur in the same place (details, group1 footer, etc). Then, I would apply a conditional format to "suppress" the section of each report based on the parameters you have created (Y/N parameter, one for each report).

    To insert multiple sections do the following:

    1) In the Design tab, locate the section containing the sub-reports.

    2) Right click on the section in the gray margin (section) area.

    3) Select Insert Section Below. A second section will appear below the original with a letter "b" after it. Example: You inserted a new section below Details. The original section becomes Details a; the new section is named Details b.

    To apply conditional formatting to a section:

    1) Right click on the section you want to format (in the gray right margin).

    2) Select Format Section (you can also do this from the Format menu).

    3) The Selection Expert appears. Make sure the correct section is highlighted (Detail a or Detail b).

    4) To the right of the Selection Expert, you will see a list of options on the Common tab. One of these options is Suppress. DO NOT check this option. Checking Suppress will suppress the section all the time, even if a condition is applied to it.

    5) To apply the condition, go to the right of the Suppress option's label and click on the blue X+2 button (it has a pencil below it). This will take you to the Format Formula Editor.

    6) Type the logic to display or suppress your sub-report based on your parameter. For the below example, I've named your parameter Report1. In Crystal syntax the statement will look like this:

    If {?Report1} = 'N' then TRUE;

    There is no need to type the FALSE part of the statement.

    7) Save and Close the Format Formula Editor.

    8) Now, the X+2 button is red. This means a condition has been applied to the format indicated to the left.

    You will find these buttons on objects when formatting them as well.

    NOTE: If your sub-reports also contain parameters (not as a result of a link), they will still appear in the parameter list when the report is run. The conditions to suppress have not been met at that time.

    I hope this helps!

  3. #3
    Join Date
    Aug 2006
    Utrecht, Holland
    Thank you very much for the advice! I will try this out.

Posting Permissions

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