SAP Knowledge Base Article - Public

1206652 - Hierarchical grouping indents an entire section rather than a specific field.

Symptom

Hierarchical grouping is needed for the left column to show record dependencies within a group. (ie. Employee ID 2 has Employee 1 as a supervisor and Employee 3 has Employee 2 as a supervisor)  However, the hierarchical grouping option indents all columns in this section rather than 1 field only.  This behavior is undesirable because the columns, at different levels in the hierarchy, are no longer left-aligned which makes it hard to read the data. 

Cause

Shifting the entire section is the default behaviour for hiearchical grouping when it is implemented in the following manner: 
-Under the Report menu select Hierarchical Grouping Options.
-Under the Parent ID drop-down, select the hiearchy field.

Resolution

It is possible to apply hierarchical indentation to specific fields with the following steps:
1. Under the Report menu select Hierarchical Grouping Options.
2. Under the Parent ID drop-down, select the hiearchy field.
3. Also in the Hierarchical Grouping Options dialog set the "Group Indent" attribute to 0 then click OK to set the changes.
4. Right click the section and choose Section Export.  In the Section Expert dialog hilight the group where hiearchical grouping is applied.
5. Uncheck 'Relative Positions' and click OK to set it and close the dialog.
6. Right click the field to be indented and choose "Object Size and Position".  Press "X-2" beside the X: field and enter the following formula in the Formula Editor:
 
numbervar hLevel := HierarchyLevel (GroupingLevel({hierarchicalGroupingField}));

numbervar deltaX := 0;

 

if (hLevel > 1) then

    deltaX := (hLevel - 1) * 0.4;

 

deltaX := deltaX * 1440;

 
7. Save and close the formula editor. 
 
Any field where this size and position formula is entered should show the data indented according to the level within the hierarchy.  However, all fields that do not have this formula applied will remain in their original alignment.
 

Keywords

hierarchical grouping, alignment, left align, hierarchy, section, entire section, one field only, shifts right, misaligned, crystal reports, indent, indentation. , 9229491 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

SAP Crystal Reports XI ; SAP Crystal Reports XI R2