Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
230
Datarelation recursive.
posted

Hi,

I have datarelation between child and parent row in the same table in one DataSet. So I have only one table that references to itself. Also I've set Band Depth to 5 so that recursion would be prevented. Everything looks good, but I have one problem child rows are displayed both in new band (connected to the parent row) and ALSO in original band. So I have them twice. I really need to show children only in child band but not again in the original.

Please advise on how to solve this issue.

Many thanks, Igor

  • 469350
    Offline posted

    Hi Igor,

        There are two ways you can handle this. 

        The most efficient way is to use two different tables. Your parent table could be generated with a query that only returns the root-level rows. Presumably, this would be easy enough to detect, you would just get all the rows whose parent key is null or something like that. Then you create a relatiopnship from this table to the child table and then child table has a relation to itself.

        A slightly easier, but less efficient way to do this is to use the InitializeRow event of the grid to hide the rows in the parent table that are really child rows. The problem with this is that the rows are just hidden, they still exist in the grid. And this can slow down your application if you have a lot of rows.