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

HOW TO CHANGE COLOR BASED ON THE VALUE

edited January 2006 in End User
How to change the format the field based on the value, such as color.

York

Comments

  • edited January 2006
    Hi York,

    For future reference, please do not post your question subject in all
    capital letters.

    You can use an event such as the Band.BeforePrint or DBText.OnPrint to
    determine what the record value is and then alter the color of the component
    accrodingly. For instance...

    procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
    begin
    if not(Report.DataPipeline[Paid]) then
    ppDBText1.Font.Color := clRed;
    end;

    --
    Regards,

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

    Best Regards,

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

    Thanks.

    Is there any way inside of report to check the field value and change the
    color.

    for example,

    I create a variable field called OverDue

    Can I do this way through calculation
    if (CurrentDate>DBPipeline1['xDueDate']) then

    OverDue.font.color := clRed

    else

    if (CurrentDate=DBPipeline1['xDueDate']) then

    OverDue.font.color := clYellow

    else

    OverDue.font.color := clBlack;

    Thanks

    York
  • edited January 2006
    Hi York,

    Yes, the following code should work. Be sure you are using an event that
    fires before the OverDue variable prints.

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