Delphi's Variables
In the Delphi projects I use Delphi's Global Variables, ??it's posible to pass/go these variables to FR, (in a Report Title Band u other Band type)?.
In a lengthy previous topic, Samuray reply:
<span style='color:blue'>Nothing problem.
frVariables := anyvalue;
after use variable with name 'ANYVARNAME' in report.</span>
But, I'm try with this method and d'ont work.
- frVariables it's a object of all frReport 's vars?
Sorry for my English, I try to explain better: I want to print (in Report Title Band and Page Header Band) some Global Delphi vars than I use in a Delphi form like: CompanyName, UserName, ComputerName and others ??How can I do it?
Thanks Again
In a lengthy previous topic, Samuray reply:
<span style='color:blue'>Nothing problem.
frVariables := anyvalue;
after use variable with name 'ANYVARNAME' in report.</span>
But, I'm try with this method and d'ont work.
- frVariables it's a object of all frReport 's vars?
Sorry for my English, I try to explain better: I want to print (in Report Title Band and Page Header Band) some Global Delphi vars than I use in a Delphi form like: CompanyName, UserName, ComputerName and others ??How can I do it?
Thanks Again
Comments
Write in Delphi code:
frReport1.LoadFromFile('mylikereport.frf');
frVariables := 'MyCompanyName, Ltd.';
frReport1.ShowReport;
In report place memo on page and double click on memo by mouse.
Print in memo:
[COMPANY]
After save (close) memo, save report with name 'mylikereport.frf' in project folder and try project to run.
FAQ:
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;
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;
I understand it and that's work.
Thanks Again