cancel
Showing results for 
Search instead for 
Did you mean: 

CR4E - how to hide certain hierarchy nodes

0 Kudos

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


Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Moved to Java SDK forum

Former Member
0 Kudos

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.

abhilash_kumar
Active Contributor
0 Kudos

Hi Bernhard,

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

-Abhilash

0 Kudos

Hello,

here are some screenshots =>

Report structure:

How it currently looks (screenshot shows only the hiearchy of the field "Kostenart", which is German for cost type):

How it should look (notice expanded nodes "sonstiger Aufwand" and "Personalkosten (o.Pensbtr.)", which is hierarchy level 4):

Thanks,

Bernhard