Print Page | Close Window

Moving Columns

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=22701
Printed Date: 06 May 2024 at 5:30am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Moving Columns
Posted By: skiman
Subject: Moving Columns
Date 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



Replies:
Posted By: olebed
Date 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


Posted By: skiman
Date 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


Posted By: olebed
Date 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.


Posted By: skiman
Date 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


Posted By: olebed
Date 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.


Posted By: skiman
Date 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



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