Problem changing a color at runtime
![Paul Coshott](https://forum.fast-report.com/en/applications/dashboard/design/images/defaulticon.png)
Hi All,
I am trying to change the background color of a MasterData band, but keep getting an error.
In my Delphi app, I am using the reports OnBeforePrint to setup a variable:
Then the script inside my report is this:
*** mdDay0 is the MasterData band. This is a report, with 7 sub reports. mdDay0 is on the first sub report.
I am getting the following error when I run the report.
The following error(s) have occured:
Script error at 4:26: Could not convert variant of type (Null)
into type (Integer)
I have tried putting the $003E9EFF inside quotes, and have tried using clRed, but I get the same error.
How should I do this?
Thanks,
Paul
I am trying to change the background color of a MasterData band, but keep getting an error.
In my Delphi app, I am using the reports OnBeforePrint to setup a variable:
procedure TForm1.XRepBeforePrint(Sender: TfrxReportComponent);
begin
XRep.Variables.Clear;
XRep.Variables['iStaff'] := 7;
end;
Then the script inside my report is this:
procedure mdDay0OnBeforePrint(Sender: TfrxComponent);
begin
if <DayPanel0."StaffId"> = <iStaff> then begin
mdDay0.Fill.BackColor := $003E9EFF;
end else begin
mdDay0.Fill.BackColor := clNone;
end;
end;
*** mdDay0 is the MasterData band. This is a report, with 7 sub reports. mdDay0 is on the first sub report.
I am getting the following error when I run the report.
The following error(s) have occured:
Script error at 4:26: Could not convert variant of type (Null)
into type (Integer)
I have tried putting the $003E9EFF inside quotes, and have tried using clRed, but I get the same error.
How should I do this?
Thanks,
Paul
Comments
Did you set iStaff as a variable in the report editor? If not it could still be NULL even when you set it.