[Lazarus] lazreport: how to use global report variables
Jesus Reyes A.
jesusrmx at gmail.com
Thu Jul 2 05:36:21 CEST 2015
En Wed, 01 Jul 2015 17:52:57 -0500, Graeme Geldenhuys
<mailinglists at geldenhuys.co.uk> escribió:
> On 2015-07-01 21:47, Jesus Reyes A. wrote:
>>
>> Those are not global variables. They are report variables.
>
> In the context of a report, they are the same thing to me. You define a
> variable via the Report GUI Designer (I still don't know how to do it
> from code), that variable is then available for use anywhere in your
> report. ie: gloabal ;-)
:)
Yes, you can consider them as global if you so desire. However they exists
only in your report, where they were defined. The frVariables list however
can be used by n-number of reports in your application. This is why I
think of them as "global"
>
>
>> I think the easier way to modify global variables is through the
>> frVariables object
>> ej.
>>
>> frVariables['HideKlas'] := 1;
>
> I'll take a look at that, thanks.
It seems possible to have report and global variables named the same,
however I have not investigated who takes precedence, I would guess report
variables are found first, but I'm not sure TBH.
>
>
>> But in LazReport this TStrings list functionality is not used.
>
> Huh? You lot me there. So if they are not used, why do those properties
> still exist in TfrReport?
They are not specific to LazReport, this is basic functionality of every
TStringList, just because they descend from TStrings. Values and Names are
public properties of TStrings, how can one hide those properties in a
instance of TStringList?, you can't, so LazReport also can't. :D
>
>
>> I was not able to find a Report.Scripts property or field, maybe you
>> mean
>> Report.Script?
>
> Sorry, it was a typo. I meant Report.Script.
>
> As far as I understand, LazReport is based on some open source version
> of FastReport. Due to the lack of documentation (or updated
> documentation) of LazReport, I looked at the documentation for
> FastReport and tried to use some if what it suggests. But it seems much
> of it doesn't translate to LazReport.
Yes, probably, however one could find that they have also many things on
common.
>
> Here is the URL of FastReport I looked at.
>
> https://www.fast-report.com/documentation/ProgMan/index.html?adding_a_variable.htm
>
> I worked through the whole "Working with a list of variables" section.
>
frxReport1.Variables['My Variable 1'] := 10; and likewise
Variable := frxReport1.Variables.Add and
Variable := frxReport1.Variables.Insert(1);
Wouldn't work on LazReport as here frxReport1.Variables is just a mere
mortal TStringList which already have a default property: Strings[]
indexed by integer, This part is in LazReport a little mess :), I think
FastReport guys noted this and they fixed the situation in FastReport.
>
> Regards,
> - Graeme -
>
--
Usando el cliente de correo de Opera: http://www.opera.com/mail/
More information about the Lazarus
mailing list