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

Changing the Value Dimension Caption of a crosstab

edited January 2007 in RAP
Hello,
I would like to know what method/property to use in the crosstab of my
report to change the Value Dimension Caption from 'Sum of XXXXX' to what
I require it to say.
I have tried to research the appropriate object and class methods and/or
properties but cannot seem to find my way through the mess of
hierarchies and individual classes to find the right syntax to place in
the calcs section of the report.

Thank you.

Joseph E. Grubs

Comments

  • edited January 2007
    Hi Joseph,

    Take a look at demo 127 located in the \RBuilder\Demos\3. Crosstabs\...
    directory. This shows which events to use to successfully customize the
    text of any given cell in a crosstab. I believe you are going to want to
    use the OnGetCaptionText event to change the text you want.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2007
    Nico Cizik (Digital Metaphors) wrote:




    Thank you Nico, but exactly where is that demo to be located? I could
    find no links or a website search option that could lead me to a demos page.

    Thank you.

    Joseph Grubs
  • edited January 2007
    The demos are installed on your hard drive in the \RBuilder\Demos directory
    when you install ReportBuilder.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2007
    Nico Cizik (Digital Metaphors) wrote:


    Nico,
    Thank you for your assistance to this point.
    Unfortunately the demos are generating runtime errors and will not
    function thus they are fairly useless to me since I cannot gather from
    the .dpm file and the individual .pas files where the routines are that
    demonstrate where and what methods/events are used to change the text of
    the Value Dimension Caption. When I attempt to identify the sql they are
    using so I could try and work around the problem by troubleshooting in
    Delphi the .dpm files lock up.
    Thus I have no examples upon which to become familiar with the
    properties and methods used to manipulate the text of the Value
    Dimension. If you could point me to any such examples on the web or
    elsewhere I would appreciate it.

    Thank you.
  • edited January 2007

    The issue here involves the fact that the OnGetCaptionText event sets
    the caption for multiple columns in the crosstab.
    If I set the:

    Procedure CrossTab1OnGetCaptionText()
    begin
    aText:='OnGetCaptionText';
    end;

    This string gets placed in three separate areas.
    One, it gets placed in the header at the top of all three columns,
    two, It gets placed along every row for the leftmost column,
    three, it gets placed in every row for the center column.
    Since there are two fields being applied here there should be two lines
    of text in that center column for each row but are set to only one if
    the aText is assigned in the event.

    I also need to know how to access the two captions that appear in this
    column.
    Obviously these two captions have individual values and are probably
    indexed within the cell for that row and column. But how do I access
    them individual? How do I reference them when assigning values to them
    individually?

    What I need to do is remove the 'Sum of' part of the Value dimension
    caption and there are no events that I know of which set these
    particular properties without also setting every other caption property.

    Thank you.
  • edited January 2007
    Hi,

    You will need to check the aRow and aColumn parameters in order to know
    which cell you are altering. For instance the following will change the
    "Sum of" cell...

    procedure CrossTabGetCaptionTextEvent(Sender: TObject; aElement: TppElement;
    aColumn, aRow: Integer; const aDisplayFormat: String; aValue: Variant; var
    aText: String);
    begin

    if (aRow = 0) and (aColumn = 0) then
    aText := 'Some custom text';

    end;

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2007
    Which version of Delphi and ReportBuilder are you using? The built-in demos
    are rigoursly tested and work correctly on all our machines here. They use
    the DBDEMOS database that is included with Delphi. You should also still be
    able to open the ct0127.pas file and see how the crosstab events are
    implemented.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2007
    Nico Cizik (Digital Metaphors) wrote:



    Nico,
    We are incorporating RBuilder as a DLL in our application. We do not
    actually use the exe. It's installed on a backward, seldomly used area
    of one of the many dozens of harddrives located somewhere on any one of
    the dozens of servers we employ.
    We are using Delphi 6 and RB for Delphi Enterprise Ed. version 7.03

    I suspect that it's not pointing to the data source correctly due to the
    way it was installed locally.

    But if I may trouble you for one additional question?

    If there are two 'Sum of XXXX' captions in each cell for each row, how
    does one reference the second of the two?

    Thank you. I appreciate your patience on this.


    Joe
  • edited January 2007
    Hi Joe,

    The same concept will apply for every cell that you need to customize. You
    will need to know the specific row and column that you would like to change.
    All the changes however can be made in the GetCaptionTextEvent. Inside this
    event, you need to check the aRow and aColumn parameters and only change the
    text if it is a certain cell. You could also check the current aText
    parameter to find all cells with the word "Sum" in it as well.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.