in
Forums
Blogs
Files
Devexpress.Com
Client Center
Support Center
DevExpress Channel

Displaying hierarchial data

Last post 11/12/2008 10:32 AM by George (Developer Express). 5 replies.
Page 1 of 1 (6 items)
Sort Posts:
Previous Next
  • 11/7/2008 4:01 PM

    • rer
    • Not Ranked
    • Joined on 11/7/2008
    • Posts 3

    Displaying hierarchial data

    I am trying to create a report that lists hiarchial data. My dataset table has an ID field and a ParentId field for each row where the parent id references the id field of its parent.

    I would like a report where at very least the children are listed undernieth its parent.

    A

    A1

    A1.1

    A2

    A2.1

    However I am also thinking about adding some indention for each level the tree.

    Any suggestion on how I can go about this using XtraReports?

  • 11/10/2008 3:48 AM In reply to

    Re: Displaying hierarchial data

    Hello,

    Maybe the following topic in our online documentation will help you: Data Grouping.

    Also, there are some step-by-step tutorials available at How to Group Data and How to Sort Data.

    Hope this helps you!

    R&D, .NET Team.

    PS. If you wish to receive direct assistance from our Support Team, use Support Center at http://www.devexpress.com/sc.
  • 11/11/2008 4:25 PM In reply to

    • rer
    • Not Ranked
    • Joined on 11/7/2008
    • Posts 3

    Re: Displaying hierarchial data

    I want to add some indention for each level of the hierarchy. I thought that I might do this by having a detail banner for each level of the hierarchy and then use the custom scripts to filter out the rows other then level of the hierarchy that the banner is for. I am presorting the data table so that child rows are directly below their parents like so.

    A

       A.1

           A.1.1

       A.2

    B

       B.1

    However with the custom scripts when I do a GetCustomColumnValue("level") it always returns the value for the first datarow. Without the filter the banner it seems to display all the rows correctly.

  • 11/12/2008 4:05 AM In reply to

    Re: Displaying hierarchial data

    In general, there should not be any problem when applying this approach. You should only call the GetCurrentColumnValue method in the label's BeforePrint event.

    So, if I got you right, and you have the following table's structure:

    ID    ParentID  Level
    A     null      0
    A.1   A         1
    A.1.1 A.1       2
    A.2   A         1
    B     Null      0
    B.1   B         1

    ...the following code should do the trick:

    int indent = 10*Level;
    ((XRLabel)sender).Padding.Left = indent;

    Again, the BeforePrint event should be handled to accomplish this.

    R&D, .NET Team.

    PS. If you wish to receive direct assistance from our Support Team, use Support Center at http://www.devexpress.com/sc.
  • 11/12/2008 10:27 AM In reply to

    • rer
    • Not Ranked
    • Joined on 11/7/2008
    • Posts 3

    Re: Displaying hierarchial data

     Thanks, that is a much better idea. Although for some reason with the version I am using there is no Padding property on XRLabel. That might explain why GetCurrentColumnValue only returns the first datarow's value. So I created a label on the form for the level and made invisible and then directly got the Text of the level to determine how far to indent.

    Thank you for the help George!

     

  • 11/12/2008 10:32 AM In reply to

    Re: Displaying hierarchial data

    Glad to hear that it helps you Smile

    You're welcome!

    R&D, .NET Team.

    PS. If you wish to receive direct assistance from our Support Team, use Support Center at http://www.devexpress.com/sc.
Page 1 of 1 (6 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED