Jump to content
Epo

FastReport: Graphic item in a field of each "Databand" line

Recommended Posts

Hi,

How can I do to bind -e.g. the color of- a shape (set on each line of a DataBand) with a field of the current line of dataset. I have tried to use the event "OnBeforePrint" (of the DataBand and of the object itself) but it does not work.  Maybe it is the field access that is not correct.


Thank for help,
Eddy

procedure DataBandOnBeforePrint(Sender: TfrxComponent);
begin
  if <Sample.CFRStatus> = '0' then
    shCFR.Visible := False
  else
  begin              
    shCFR.Visible := True;  
    if <Sample.CFRStatus> = '2' then
      shCFR.Color := clRed
    else
    if <Sample.CFRStatus> = '1' then
      shCFR.Color := clGreen;
  end;  
end;  
 
procedure shCFROnBeforePrint(Sender: TfrxComponent);
begin
  if <Sample.CFRStatus> = '0' then
    shCFR.Visible := False
  else
  begin              
    shCFR.Visible := True;  
    if <Sample.CFRStatus> = '2' then
      shCFR.Color := clRed
    else
    if <Sample.CFRStatus> = '1' then
      shCFR.Color := clGreen;
  end;  
end;


 

Edited by Epo

Share this post


Link to post
Guest

OnBeforePrint is the correct event.

In my "FR scripts" the fields are accessed like so: <Table."FieldName">

Note the "'s.

You can also use "View | Toolbars | Data Tree" and double click a field. It will be pasted into you script with the correct format for your setup.

 

HTH,

 

/Dany

Edited by Guest

Share this post


Link to post

Effectively, the ' " ' was missing. And it does the trick.

 

Thank Dany,

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×