Report control: add records & field order
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=1380
Printed Date: 09 May 2025 at 1:54pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Report control: add records & field order
Posted By: nighthawk
Subject: Report control: add records & field order
Date Posted: 07 November 2004 at 1:01pm
I am looking over the sample code for adding records to the report
control. Adding the individual ReportRecordItem objects to
the row doesn't appear to be able to take into account a user
customized column order. For example:
Record.Add Item "RE: Your
Invoice"
Record.Add Item "John
Smith"
Record.Add Item "19/06/2004"
Record.Add Item "18k"
This code adds the fields in the order it is executed in code but if
the user switches the order of two of the colums, future records will
not be added correctly. Is there any way to add the
ReportRecordItem objects idependantly of the column order?
Something like: "Record.AddItem (Value, ColumnID)" would be nice.
|
Replies:
Posted By: SuperMario
Date Posted: 08 November 2004 at 9:06am
It doesn't matter how much the user move the columns or hides\removes
columns. You just need to make sure that you add the items in the
exact same order that the columns were added (regardless of the current
column arrangement). You need to also account for the columns
that are not currently visible. So as long as you add items in
the same order that they you added the columns and add information for
all of the item, you should never have any problems.
|
Posted By: nighthawk
Date Posted: 13 November 2004 at 5:45pm
Unfortunately, it doesn't look like it is as simple as you say.
It looks like the ReportRecordItem objects are added in the order of
the columns ItemIndex value, not just in the order that the columns are
added. I thought the ItemIndex value was just an arbitrary
identifier so I was using an enum with high values just to ensure all
columns on all tables had a unique ID number. That doesn't work
because the ItemIndex must start at 0. It took me a while to
figure this out.
For example, the following code will add the ReportRecordItems correctly as expected:
wndReportControl.Columns.Add(0, "Subject", 50, True)
wndReportControl.Columns.Add(1, "From", 50, True)
wndReportControl.Columns.Add(2, "Date", 50, True)
wndReportControl.Columns.Add(3, "Size", 50, True)
Record.Add Item "RE: Your Invoice"
Record.Add Item "John Smith"
Record.Add Item "19/06/2004"
Record.Add Item "18k"
But the following also looks like it will add the ReportRecordItems
correctly even the the columns are added in reverse order since their
ItemIndex value didn't change:
wndReportControl.Columns.Add(3, "Size", 50, True)
wndReportControl.Columns.Add(2, "Date", 50, True)
wndReportControl.Columns.Add(1, "From", 50, True)
wndReportControl.Columns.Add(0, "Subject", 50, True)
Record.Add Item "RE: Your Invoice"
Record.Add Item "John Smith"
Record.Add Item "19/06/2004"
Record.Add Item "18k"
|
|