[Lazarus] Lazreport variables

Santiago A. svaa at ciberpiula.net
Sun May 3 18:03:12 CEST 2020


Hi:

I want to write a report where even lines are written with no background 
and odd lines with a light gray background.
The idea is an memo (MemoBackground) in the background of the masterData 
Band that is gray and I set visible or invisible, according with the line.

I have created a report variable "LineCounter"

In the ColumnHeader band (the report has two columns) I have a Script

Begin
  LineCounter:=0;
end;

In the GorupHeader header I have this script

Begin
  LineCounter:=0;
end;

In the masterData band Script:

begin
  LineCounter:=LineCounter+1;
  MemoBackground.visible:=(LineCounter mod 2 = 0);
end

When I prepare the report, I get "Invalid Variant Type Cast"

After debugging a little, I have found LineCounter is undefined when it 
is on the right side of assignment.
When It executes  LineCounter:=0; it assigns to a frVariables, a global 
public var in Unit LR_Class.
But when it tries to get its value it searches en a field "values" of 
TfrReport.

I've also tried

LineCounter:=[LineCounter]+1;

With brackets, the same result. (Not sure what brackets are for in scripts)

Any hint? What am I missing?

-- 
Saludos

Santiago A.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200503/c5382c7d/attachment.html>


More information about the lazarus mailing list