Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - Report control: add records & field order
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Report control: add records & field order

 Post Reply Post Reply
Author
Message
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post Topic: Report control: add records & field order
    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.
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post 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"
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.