Skip to Content

CR4E - how to hide certain hierarchy nodes

Hello there,

I'm new to Crystal Reports and hope you can help me...

I created a report based on a BEx query with one dimension "costtype" (hierarchy) and some key figures. The data is looking good but the formating needs to be adjusted. => Currently the report shows all 4 levels of the hierarchy but instead I would like to show the 4th hierarchy level only for two certain nodes, while all other nodes should only display up to level 3.

So first I created a group for costtype. At the group header I entered a formula to hide the 4th level which looks like this: if HierarchyLevel(GroupingLevel({reportname.costtype\costtype}))=4 then true

That's working fine so far. Next I entered another formula for the body section which should hide the first three levels. Formula looks like this: if HierarchyLevel(GroupingLevel({reportname.costtype\costtype}))<4 then true

That's working fine too, so the group header now shows level 1-3 while the body section shows level 4. Then I entered one more formula for the whole body area which should hide itself except for two certain nodes. Here's the formula: if GroupName ({reportname.costtype\costtype})="node1name" or GroupName ({reportname.costtype\costtype})="node2name" then false else true

Now here's the problem because then the 4th hierarchy level is not shown anymore at all. I'm guessing the group name just is not recognized correctly. Any ideas what I did wrong? Or maybe even an easier and more elegant solution for the hierarchy formating?

Thank you very much,

Bernhard


Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on May 27, 2013 at 11:21 AM

    Hi Bernhard,

    The setup is a little confusing. Do you have some screenshots to assist this please?

    -Abhilash

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2013 at 04:47 PM

    Hi Bernhard

    It sounds like you have multiple conditions that cause the detail section to be suppressed.

    When I have complex suppress conditions I usually create a suppress_flag variable in my formula that I can turn on or off depending on a sequence of conditions.

    Stringvar suppress_flag:=”off”;

    //Condition 1

    if GroupName ({reportname.costtype\costtype})="node1name" or GroupName ({reportname.costtype\costtype})="node2name" then suppress_flag:=”on”;

    //Condition 2

    if HierarchyLevel(GroupingLevel({reportname.costtype\costtype}))<4 then suppress_flag:=”off”;

    //display or supress

    suppress_flag=”on” //suppresses the section

    The trick is defining the sequence of conditions that turn the suppress_flag on or off.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 29, 2013 at 01:14 PM

    Moved to Java SDK forum

    Add a comment
    10|10000 characters needed characters exceeded