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

Conditional Formating CrossTab

edited July 2005 in Subreports
How could i do some conditional formating in a CrossTab.
When using the on FormatCell i can't reach the value printed in the cell,
when using OnGetValueText, and there formating the TppElement, all values
changes.

Any Suggestions ?

Comments

  • edited July 2005
    Hi Harry,

    If you do not want to affect all values, try checking the aColumn and aRow
    parameters of the OnGetValueText event. This will allow you to only alter
    certain cells and leave the others alone.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2005
    Sorry, this is my code

    var

    dValue : Double;

    begin

    if (aRow > 1) and (aColumn > 2) then

    if (aRow-2) mod 3 = 1 then

    begin

    if aColumn mod 4 = 0 then

    begin

    aElement.Color := clYellow;

    aText := aText + '[' + IntToStr(aColumn mod 4) + ']';

    end;

    end

    else if (aRow-2) mod 3 = 2 then

    begin

    CrossTab_Calc_2_Column_Values(CT_NetSales, aColumn, aRow, -2, -1, '/',
    dValue);

    aText := FormatFloat('###,##0.00', dValue);

    end;

    And i'm only seeing the [0] in some columns, but the complete line is in
    yellow (or whatever color i choose).

  • edited July 2005
    Hi Harry,

    Thanks for the code, however it is very difficult for me to test something
    like this without an example of the crosstab you are using. If you trace
    this code are the correct conditions firing at the right times? Is this
    event firing only once per record?

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2005
    This code in fire on every OnGetValueText of the crosstab (it's in RAP).
    Every 4th column i'm seeing this [0] (coded) in the right column.
    But, the Yellow is in every cell.

    You should be able with any small crosstab to code this.

  • edited July 2005
    Once you change the value of the TppElement.Color, it will remain that color
    unless you change it back to it's original. Try doing something like the
    following...

    if aColumn mod 4 = 0 then
    begin
    aElement.Color := clYellow;
    aText := aText + '[' + IntToStr(aColumn mod 4) + ']';
    end
    else
    aElement.Color := clWhite;


    --
    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.