Page 1 of 1

Hierarchical master detail

Posted: Thu Apr 03, 2008 7:05 am
by Jacco van der Pol
Hello,

I'd like to build an hierarchical master detail report. The master should be hierarchical, the detail should indent with the master. I did this by first creating a hierarchical band with some fields and adding a container on it with a databand.

This works file, but as the hierarchical band indents, the container indents with it, over the right border of the page. How can I make the container and its contents autoschrink to the max width of the parent hierarchical band.

Jacco

Hierarchical master detail

Posted: Fri Apr 04, 2008 8:29 am
by Edward
Please do as follows:

- Place a hierarchical band with zero height before your hierarchical band. All properties ofthis bands must be the same (except height).

- Declare a double type variable Dist in the Dictionary.

- In the new Hierarchical Band write the following EvenHandlers:

BeforePrintEvent:

Code: Select all

int level = (sender as StiHierarchicalBand).DataSource.GetLevel();
if (level > 0)
{
  if (level * this.Unit.ConvertFromHInches((sender as StiHierarchicalBand).Indent) > Dist)
  {
	  Dist = level * this.Unit.ConvertFromHInches((sender as StiHierarchicalBand).Indent);
  }
}
EndRenderEvent:

Code: Select all

Container1.Width = Container1.Width - Dist;
TextInsideTheContainer.Width = TextInsideTheContainer.Width - Dist;
You can open the attached report in the Demo example application from the standard delivery and see all that in action.

Thank you.