I want to format these parent/child groupings...however, if I indent the child, i then have all of the other columns off center, which i don't want....is there a formula function that states if the current record is a child of another record???
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.
I am getting an error with these 2 formulas...I have 4 Groups...I want the hierarcy value to be displayed on gf4 because it is displayed like this...
GH3
GF4
In ReportHeader:
WhilePrintingRecords;
numbervar array levels:=[0,0,0,0,0]; //supports 5 levels
levels[5];
In GH3:
//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({Star_SPWipAging.parentclientid}) then
levels[1] := {Star_SPWipAging.clientID};
if not isnull({Star_SPWipAging.parentclientid}) then
for i:= 1 to count(levels)-1 do (
if {Star_SPWipAging.parentclientid} = levels then levels[i + 1] := {Star_SPWipAging.clientID});
//levels[1]; // don't need to do anything here - but helpful for testing
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.