Print Page | Close Window

Relationship between Rows and Records

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=15255
Printed Date: 20 May 2024 at 12:46pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Relationship between Rows and Records
Posted By: Ares
Subject: Relationship between Rows and Records
Date Posted: 28 September 2009 at 6:39am
Hi!

I am just trying out the Report Control and I was not able to figure out the releationship between rows and records.

As I understood:
- Each row has ONE record.
- Each records holds on or more RecordItems representing the cells of each row.
- There is no Add methode for rows. Rows are added by using ReportControl.Records.Add(...)

What is the reason for the seperation of rows and records? Is there an easy and quick way to find the correspondig row object to a record object without searching all rows?

I have used the following procedure to add a row/record. This works fine but both messages show that ReportControl.Rows is still empty. How can that be?

        public void AddItem(Object obj) {
            MessageBox.Show(ReportControl.Rows.Count.ToString()); // --> 0

            ReportRecord newRecord = ReportControl.Records.Add();
            SetRecordData(newRecord, obj);

            MessageBox.Show(mailListReport.Rows.Count.ToString()); // --> 0
        }



Replies:
Posted By: ijwelch
Date Posted: 28 September 2009 at 11:36am
As far as I know, the ReportRecord object is just a collection of ReportRecordItems. It should probably be named Items (but too late for that now), so where we have:

Row.Record(n) 'as ReportRecordItem

can be thought of as:

Row.Items(n)


It's further confused by not having a Rows.Add method. As you know you add a Row by adding a Record (which is just a collection of Items). A bit weird I think but again, probably too late to do anything about it now.

You can use the ReportControl.Rows.FindRow(Record) method to get the row for a record. Again, a bit weird. Maybe just having Record.Parent would be better.

I expect you're seeing Rows count at zero because you have not called ReportControl.Populate yet.

-------------
ExtremeSuitePro 12.1.1
WinXP SP3


Posted By: adrien
Date Posted: 29 September 2009 at 1:04am
you can have rows that don't have records - e.g. group header rows.

-------------
http://www.wingate.com - http://www.wingate.com


Posted By: Ares
Date Posted: 29 September 2009 at 4:53am
Does anyone know how ReportControl.Rows.FindRow(Record) works? Is this realy a search (complex when using many, many rows/records) or does it use some kind of index or directory?




Posted By: mdoubson
Date Posted: 29 September 2009 at 7:32pm

"Finds row corresponded with specified record" - ReportRow* FindRow(IReportRecord* Record)

CXTPReportRow* CXTPReportRows::Find(CXTPReportRecord* pRecord) {

for (int i = 0; i < (int) m_arrRows.GetSize(); i++) {

if (m_arrRows.GetAt(i)->GetRecord() == pRecord) return m_arrRows.GetAt(i); }

return 0; }

"Finds row corresponded with specified record (throughout the tree)"  - ReportRow* FindRowInTree(IReportRecord* Record)

CXTPReportRow* CXTPReportRows::FindInTree(CXTPReportRecord* pRecord) {

for (int i = 0; i < (int) m_arrRows.GetSize(); i++) {

if (m_arrRows.GetAt(i)->GetRecord() == pRecord)  return m_arrRows.GetAt(i);

if (m_arrRows.GetAt(i)->HasChildren()) {

CXTPReportRow* pRow = m_arrRows.GetAt(i)->GetChilds()->FindInTree(pRecord);

if (pRow) return pRow; }

}

return 0; }



-------------
Mark Doubson, Ph.D.



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