Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Moving Columns
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Moving Columns

 Post Reply Post Reply
Author
Message
skiman View Drop Down
Groupie
Groupie


Joined: 20 December 2008
Location: Belgium
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote skiman Quote  Post ReplyReply Direct Link To This Post Topic: Moving Columns
    Posted: 26 August 2015 at 9:30am
Hi,

I have a report control with the same columns as in the following sample screenshot.


If I move the column Sales and put it between 'Product' and 'State' the grouptotal remains in the same column, which is state at that moment.

How can I be sure that my subtotals remains in the same column as originally at startup?


ABO Service
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2015 at 6:26am
Hello Chris,

Subtotals are linked to appropriate columns.

If you have access to C++ project  then you can change this behaviour in CXTPReportPaintManager::DrawGroupRow method (toolkitpro\Source\ReportControl\XTPReportPaintManager.cpp). Index of appropriate column is in iCol variable.

Regards,
Oleksandr Lebed
Back to Top
skiman View Drop Down
Groupie
Groupie


Joined: 20 December 2008
Location: Belgium
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote skiman Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2015 at 8:24am
Hi,

I'm using the active-x version.

I tried to change the groupformula of the grouprow dynamically when a column is moved.
Sample:
formula SUMSUB(C5:C6) is changed to SUMSUB(C3:C4) when the column is moved. The subtotals are moving, but strangely they remains now zero. I have no clue what the cause of this behaviour could be.

ABO Service
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2015 at 11:33am
When you move columns their indexes are not changed, just their order. So C5 - always points to the column with index 5.
Back to Top
skiman View Drop Down
Groupie
Groupie


Joined: 20 December 2008
Location: Belgium
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote skiman Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2015 at 3:48am
You wrote: When you move columns their indexes are not changed, just their order. So C5 - always points to the column with index 5.

I'm using the active-x evaluation version  16.4.0, and the index IS CHANGING when moving columns. I tested as follows:
When creating the columns:
oColumn := oReport:Columns:add(0, "Category", 12, .t.)
oColumn:key := str(oColumn:index,2)
...

So I put the index for each column in the KEY property.

When the report is created, I do the following:
nCols := oReport:Columns:Count -1
for x = 0 to nCols
    show oReport:columns(x):index
    show oReport:columns(x):key
next
For each column, the index is equal to the key.

When I move a column, and checks it again, the INDEX is changed. The index isn't corresponding anymore to the KEY which obviously isn't changed.

This behaviour poses a lot of problems when columns with subtotals are moved. This is why I need to change the formula. I'm using the value in the KEY property to define which column must have subtotals.

Since the data shown is still correct, there must be a property that knows which item of the record must be shown. After moving a column for 4 to column 2, the index is changed. However it is still oRecord:item(4) which is shown.







ABO Service
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2015 at 11:08am
Sorry, I meant  ItemIndex Property of ReportColumn Object.
From documentation
Quote Remarks
This is the index of the column given when added to the ReportControl's collection of columns. The ItemIndex starts at 0 and increments by 1 for each column in the ReportControl. The ItemIndex will not change when the columns are moved (dragged and dropped to another location).

The ItemIndex is used to find and return a reference to a column. Since the Index of the column might change frequently, the ItemIndex is used when the column needs to be accessed.
Back to Top
skiman View Drop Down
Groupie
Groupie


Joined: 20 December 2008
Location: Belgium
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote skiman Quote  Post ReplyReply Direct Link To This Post Posted: 01 September 2015 at 4:10am
Hi,

Thanks, I missed this ItemIndex property.

So no need anymore to keep the original index in the KEY property. Smile
ABO Service
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.172 seconds.