We published a technique to work with hierarchical group levels in August 2002 (Crystal Clear 28).
You need to use variables to track what level in the hierarchy you are.
A reset formula in the Report Header section
WhilePrintingRecords;
numbervar array levels:=[0,0,0,0,0]; //supports 5 levels
levels[1];
A formula in the Group Header to calculate the group level we are in.
WhilePrintingRecords;
numbervar array levels; // array of hierarchy index
numbervar i; //counter for loop
if isnull({Employee.Supervisor ID}) then
levels[1] := {Employee.Employee ID};
if not isnull({Employee.Supervisor ID}) then
for i:= 1 to count(levels)-1 do (
if {Employee.Supervisor ID} = levels
then levels[i + 1] := {Employee.Employee ID});
levels[1]; // don't need to do anything here - but helpful for testing
You now have an array of where you are in the hierarchy, and you can use this for indenting selected columns, or conditionally suppress some levels of the hierarchy.
Editor and Publisher of Crystal Clear