Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Crosstab data keeps repeating indefinitely

Hi,

I'm using a crosstab for the first time and have it working ok except for the fact that the output data is repeated indefinitely. For example, if I expect:

Average My_Data Manager
Customer Fred George Harry Grand_Total
A1 1000 2000 1500 4500
A2 250 500 750
B1 3000 3000
Grand Total 4000 2250 2000 8250

I actually get:

Average My_Data Manager
Customer Fred George Harry Grand_Total
A1 1000 2000 1500 4500
A2 250 500 750
B1 3000 3000
Grand Total 4000 2250 2000 8250
Average My_Data Manager
Customer Fred George Harry Grand_Total
A1 1000 2000 1500 4500
A2 250 500 750
B1 3000 3000
Grand Total 4000 2250 2000 8250
Average My_Data Manager
Customer Fred George Harry Grand_Total
A1 1000 2000 1500 4500
A2 250 500 750
B1 3000 3000
Grand Total 4000 2250 2000 8250
....

Ie the same table repeated.

I'm guessing it's something to do with the data source ( TADOQuery -> TDataSource -> TppDBPipeline) but I can't see what. Also, if I connect a simple list report to the same data source, it works fine.

Any suggestions as to where I start (I have searched this forum, looked in rbWiki and at the demos)

I am running ReportBuilder 20.0 build 255 from Delphi 10.3 update 2

Finally, is it possible to rotate the text in the column titles of the crosstab to keep the report width down?

Thanks

Steve Everington

Comments

  • Hi Steve,

    The issue is likely that your report is connected to the same dataset as the crosstab. This means that the crosstab will repeat for each detail band inside the report. If you would like the crosstab to display only once, you can disconnect the report from the data (Report | Data... option from the main menu in the designer), or place the crosstab inside a different band than the detail.

    You can use the Orientation property of the TppElement class to rotate text in 90 degree increments. In order to change the orientation of text within the crosstab, you will need to do so in code using a crosstab event such as the OnGetCaptionText. Below is a sample of what your code might look like to render all of the column headers vertically.

    procedure TForm1.ppCrossTab1GetCaptionText(Sender: TObject; aElement: TppElement; aColumn, aRow: Integer; const aDisplayFormat: string; aValue: Variant; var aText: string);
    begin
    if aElement = nil then Exit;

    if (aRow = 1) and (aColumn > 0) then
    aElement.Orientation := orBottomToTop
    else
    aElement.Orientation := orLeftToRight;

    end;
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Hi Nico,

    Thanks! It's working correctly now and the alignment issue is resolved.

    Steve
Sign In or Register to comment.