![]() |
Report control: add records & field order |
Post Reply ![]() |
Author | |
nighthawk ![]() Senior Member ![]() ![]() Joined: 11 June 2004 Status: Offline Points: 167 |
![]() ![]() ![]() ![]() ![]() 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. |
|
![]() |
|
SuperMario ![]() Admin Group ![]() ![]() Joined: 14 February 2004 Status: Offline Points: 18057 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
nighthawk ![]() Senior Member ![]() ![]() Joined: 11 June 2004 Status: Offline Points: 167 |
![]() ![]() ![]() ![]() ![]() |
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" |
|
![]() |
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 |