undeclared identifier "frvariables"
Hi
I am trying to pass a string to my report using form2.frreport1.frvariables:='2351';
but i get a compiler error undeclared identifier "frvariables" if i leave the line out my everything else works fine.
Can you suggest what I am doing wrong?
Thanks
Pete
PS
It is freereports that I am using
I am trying to pass a string to my report using form2.frreport1.frvariables:='2351';
but i get a compiler error undeclared identifier "frvariables" if i leave the line out my everything else works fine.
Can you suggest what I am doing wrong?
Thanks
Pete
PS
It is freereports that I am using
Comments
from faq.txt
2.25. How to pass a value to the report?
*************
There are several methods to do this. First is to use global object
frVariables (defined in FR_Class unit):
frVariables := 10;
*****Note no dot notation in front of frvariables but do it after loading a report.
**** also as noted below watch the string value passed in in some cases you must wrap with ''''+ 'strval' +''''
This code creates a new variable with 'My variable' name and value = 10.
This method is best to pass static data to the report.
Second method is to use the TfrReport.OnGetValue event. You can use this
method to pass dynamic data, i.e. data that changes from record to record.
procedure TForm1.frReport1GetValue(ParName: String; var ParValue: Variant);
begin
if ParName = 'MyField' then
ParValue := Table1MyField.Value;
end;
Finally, third method is to define variable from dictionary programmatically:
with frReport1.Dictionary do
begin
Variables := 'CustomerData.Customers."CustNo"';
Variables := '10';
end;
(can I pass data from report to the program?)
Use frVariables object. If you write the following code in any script:
MyVariable := 10
then in your program you can use this code to retrieve MyVariable value:
v := frVariables;
and how does that work in bcbuilder(6). I always get compiler errors...
Something like : can't convert from char* to int,
TfrVariables::operator=(int) not found...
Thanks and regards,
Andi