1201893 - How to display a hierarchy according to the Parent " Child relationship in Crystal Reports

SAP Knowledge Base Articles - public

1201893 - How to display a hierarchy according to the Parent " Child relationship in Crystal Reports


A report contains a hierarchy. This hierarchy is based on a field within the database and is established using the Hierarchial Grouping options on the Report menu of Crystal Reports.

The report contains a group and a Detail section. The Details section is hidden so that only the names of the leves are displayed. The following structure is an illustration:









The requirement is to only display the direct and indirect children of LEVEL2A. The requirement is illustrated below:








1 - In the above example the LEVEL2A is the group level number 2; so, create a formula " VariableX - to define a variable which is assigned to the first 7 letters of this group level - GroupNumber 2:



Global stringVar x;

if GroupNumber = 2 then

x:= Left({field_on_which_the hierarchy is defined},7);


2 - Create a new section of the group header 1 so as to have GH1a and GH1b;


3 " Move all the objects from the GH1b to the GH1a and in the GH1a place the "VariableX" formula;


4 " Suppress the GH1a section;


5 " Conditionally suppress the GH1b:

      Open Section Expert and from the "Sections" screen on the left, select the GH1 section; from the Common tab, click once on the "X+2" button and enter the following formula:



      stringVar x;

      GroupNumber = 1  or

      if Left({field_on_which_the hierarchy is defined }, 7)= x then true


      This formula suppresses the section when the Group number is equal to 1 or if the first 7 letters of the field are different from the X variable; as a result, if the field is equal to LEVEL2B and X is equal 
      to LEVEL2A, this section will be suppressed.


hierarchy, Parent " Child relationship, relationship, level , 5637576 , KBA , BI-RA-CR , Crystal Reports designer or BusinessViews Manager , How To


Crystal Reports 2008 V0 ; SAP Crystal Reports XI ; SAP Crystal Reports XI R2