Print Page | Close Window

Group By Column ?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=3596
Printed Date: 04 May 2024 at 2:24pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Group By Column ?
Posted By: John31
Subject: Group By Column ?
Date 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



Replies:
Posted By: SuperMario
Date 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


Posted By: John31
Date 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


Posted By: SuperMario
Date 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


Posted By: John31
Date Posted: 03 February 2006 at 12:15pm
That does it!!

-------------
Regards

John Layton



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net