![]() |
Looping through ALL rows |
Post Reply
|
| Author | |
markmark
Senior Member
Joined: 30 November 2007 Status: Offline Points: 142 |
Post Options
Thanks(0)
Quote Reply
Topic: Looping through ALL rowsPosted: 27 November 2010 at 9:52am |
|
Hi Is there a nice simple way that I can loop through all the rows on the grid. Even if there are Child items as well. or even lots of childs of child (a child is a parent item) I note that wndReportControl.Rows.Count changes if the parent is expanded, if its not the count doesn't include the childs. So this is simple, but no good if a parent is closed up For lngRow = 0 To wndReportControl.Rows.Count - 1 value = value & wndReportControl.Rows.Row(lngRow).Record.Item(2).Value Next This method ignores child completely For Each rRecord In wndReportControl.Records Next so you end up doing tests like, For Each rRecordChild In rRecord.Childs
Does any one know of a better way Many Thanks Mark |
|
|
Product: Xtreme SuitePro (ActiveX) version 13.0.0
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 |
|
![]() |
|
Aaron
Senior Member
Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
Quote Reply
Posted: 28 November 2010 at 3:16am |
|
Hi,
You would expect that for each loop would work on records but it doesn't... Well, you could create function and loop child records recursively, something like this:
Private Function IterateReportCollection()
Dim xtremeRecord As XtremeReportControl.ReportRecord For Each xtremeRecord In Me.wndReportControl.Records 'Checking goes here If xtremeRecord.Childs.Count > 0 Then 'found record with child(s), so first check the child(s) IterateChilds xtremeRecord End If Next xtremeRecord End Function Private Function IterateChilds(xtremeRecordParent As XtremeReportControl.ReportRecord)
Dim xtremeRecord As XtremeReportControl.ReportRecord For Each xtremeRecord In xtremeRecordParent.Childs 'Checking goes here If xtremeRecord.Childs.Count > 0 Then 'found record with child(s), so first check the child(s) IterateChilds xtremeRecord End If Next xtremeRecord End Function Good luck
|
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
![]() |
|
markmark
Senior Member
Joined: 30 November 2007 Status: Offline Points: 142 |
Post Options
Thanks(0)
Quote Reply
Posted: 28 November 2010 at 8:06am |
|
Thanks you Aaron.
Its a shame it can't be done!
Where AllRecords includes childs.
For Each xtremeRecord In Me.wndReportControl.AllRecords
Next xtremeRecord Again thanks for your help, this forum would be very dead without you! Mark
|
|
|
Product: Xtreme SuitePro (ActiveX) version 13.0.0
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 |
|
![]() |
|
Aaron
Senior Member
Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
Quote Reply
Posted: 28 November 2010 at 8:40am |
Hi Mark,
First of all I didn't know that child records weren't part of Record collection because I never used parent/childs in RC. I'm glad I read your post again because I wanted to answer: just iterate Record collection instead of Row collection
So, my next question to support: Why aren't childs, part of Record collection? We have HeaderRecords, FooterRecords and Records collection and none of these collections contains the childs of parent records....
I will add this to my list and see what happens...
Thanks
|
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
![]() |
|
markmark
Senior Member
Joined: 30 November 2007 Status: Offline Points: 142 |
Post Options
Thanks(0)
Quote Reply
Posted: 29 November 2010 at 4:03am |
|
Hi Aaron.
I hope they add the childs in the next update, would make sense to me.
Interestinly wndReportControl.SelectedRows does include childs, but only if they are expanded
Mark
|
|
|
Product: Xtreme SuitePro (ActiveX) version 13.0.0
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 |
|
![]() |
|
Michael S.
Newbie
Joined: 06 October 2009 Status: Offline Points: 4 |
Post Options
Thanks(0)
Quote Reply
Posted: 29 November 2010 at 5:43am |
|
As I understood the ReportControl, the Rows collection always represents the visible rows in the control, with sorting, filtering, etc. applied. If you want to process all your data in the control, being it visibile or not, you have to process the Records collection including the Childs collection for every record if Childs.Count > 0. Remember, that the records aren't necessarily in the same order as the Rows. (It's a little bit like MVC.) |
|
|
Product: Xtreme SuitePro (ActiveX) version 15.1.3
Platform: Windows 7 Prof. SP 1 x64 Language: Visual Basic 6.0 |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |