Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Group By Column ?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Group By Column ?

 Post Reply Post Reply
Author
Message
John31 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 December 2005
Location: United States
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote John31 Quote  Post ReplyReply Direct Link To This Post Topic: Group By Column ?
    Posted: 03 February 2006 at 10:55am

When adding a column to the groups order using GroupsOrder.Add the column remains visible in the ReportControl.  However, if you ShowGroupBox and then drag a column to the GroupBox it removes it from the ReportControl. 

Is there a way to make the drag opertion to GroupBox behave the same as it does when you do the GroupsOrder.Add?

If not, can I code arround it to put the column back in the ReportControl once it has been added to the GroupBox? 

Is there an event that fires when the GroupBy has changed?

 

 

 

 

Regards

John Layton
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 03 February 2006 at 11:38am
Can't think of a good way as this is the way it is supposed to behave.  Maybe something like:

'Global
Dim currentGroupCount As Integer

'In Form_Load
currentGroupCount = wndReportControl.GroupsOrder.Count
   

Private Sub wndReportControl_ColumnOrderChanged()
    If (wndReportControl.GroupsOrder.Count > currentGroupCount) Then
        wndReportControl.GroupsOrder.Column(wndReportControl.GroupsO rder.Count - 1).Visible = True
        wndReportControl.Redraw
        currentGroupCount = currentGroupCount + 1
    ElseIf (wndReportControl.GroupsOrder.Count < currentGroupCount) Then
        currentGroupCount = currentGroupCount - 1
    End If
End Sub
Back to Top
John31 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 December 2005
Location: United States
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote John31 Quote  Post ReplyReply Direct Link To This Post Posted: 03 February 2006 at 12:02pm

Thanks Mario that worked for what I needed.  I will have to live with the other behavior for now as I don't think it will be a big deal.

It would be nice to have an option GroupsOrder.Delete (ReportColumn)  in addition to the DeleteAll.  It would make the follow code easier.  Keep up the great work!!!!

Case ID_REPORTCONTROL_GROUP_BY_COLUMN
    If Control.Checked Then
        Dim cCol As New Collection
        Dim oCol As ReportColumn
        For i = 0 To RC1.GroupsOrder.Count - 1
             If RC1.GroupsOrder(i).Caption <> RC1.Columns.Find(Control.Parameter).Caption Then
                 cCol.Add RC1.GroupsOrder(i)
             End If
        Next i
        ' now remove all columns
        RC1.GroupsOrder.DeleteAll
        ' put the other ones back in
        For i = 1 To cCol.Count
             Set oCol = cCol(i)
             RC1.GroupsOrder.Add oCol
        Next i
    Else
        RC1.GroupsOrder.Add RC1.Columns.Find(Control.Parameter)
    End If
    m_lGroupCount = RC1.GroupsOrder.Count
    RC1.Populate
    UpdateRowCounts

 

 

Regards

John Layton
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 03 February 2006 at 12:14pm
Why not something like this?

'For this I assume Control.Parameter is the ID of the column that was hidden

Case ID_REPORTCONTROL_GROUP_BY_COLUMN
    If Control.Checked Then
         wndReportControl.GroupsOrder.RemoveAt(wndReportControl.Group sOrder.IndexOf(wndReportControl.Columns.Find(Control.Paramet er)))
    Else
        RC1.GroupsOrder.Add RC1.Columns.Find(Control.Parameter)
    End If
    m_lGroupCount = RC1.GroupsOrder.Count
    RC1.Populate
    UpdateRowCounts
Back to Top
John31 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 December 2005
Location: United States
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote John31 Quote  Post ReplyReply Direct Link To This Post Posted: 03 February 2006 at 12:15pm
That does it!!
Regards

John Layton
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.