Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Databind Parent Child
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Databind Parent Child

 Post Reply Post Reply
Author
Message
Skreen View Drop Down
Groupie
Groupie


Joined: 23 March 2013
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote Skreen Quote  Post ReplyReply Direct Link To This Post Topic: Databind Parent Child
    Posted: 19 November 2014 at 6:33am
I am trying to see if I can bind a recordset to the .DataManager of the Report control and specify the parent and child key fields so that the hierarchy is created. Currently I am just binding the recordset and then going through each row and finding the related rows and moving the child rows to the .Childs row of the parent.

manual code example

Set lstResults.DataManager.DataSource = objRecordset
lstResults.DataManager.DataBind
' go through each row
For Each objReportRow In lstResults.Rows 
    ' check for a child row with a parent Id value
    If objReportRow.Record(4).Value <> "0" Then  
        ' find the parent row
        Set objReportParentRecord = lstResults.Rows.FindRecordItemByRows(0, lstResults.Records.Count, 0, 3, 0, 0, objReportRow.Record(4).Value, xtpReportTextSearchExactPhrase)
        If Not objReportParentRecord Is Nothing Then
            Set objParentRecord = objReportParentRecord.Record
            ' move the child row to the Childs collection of the parent
            If objParentRecord.Childs.Count = 0 Then
                Call objParentRecord.Childs.InsertAt(0, objReportRow.Record)
            Else
                Call objParentRecord.Childs.InsertAt(objParentRecord.Childs.Count, objReportRow.Record)
            End If
            lstResults.Records.RemoveAt objReportRow.Index
            'objParentRecord.Expanded = True
        End If
    End If
Next
    
lstResults.Populate

would like to do it something like this:

Set lstResults.DataManager.DataSource = objRecordset
lstResults.DataManager.ParentId = objRecordset.Fields("ParentOrderNo")
lstResults.DataManager.ChildId = objRecordset.Fields("OrderNo")
lstResults.DataManager.DataBind

I know this does not exist at the minute, but is there any way to create a hierarchy in the grid when data binding?

Initial flat grid bound to recordset






















Grid after it has been reorganised

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.219 seconds.