Yes you can do that, but first you must include to your application the unit where the external variable is located with the "uses" this way you can make a reference of your object in the application
This variable CustomerCode looks to me like something that is in a table but ..
My advice, make use of Datamodules. Put your tables and querys on the Datamodules and and also every global variable you want to use somewhere in your program.
The Datamodule is a container for non visual components like tables, datasources, imagelists, stringlists and your own non-visual variables. Steven van Els
SAvanEls@cq-link.sr
In the first place, my English is not very good so excuse me if you dont understand something.
The fact is very simple after all:
How can you use a value (const or var) for to print in a QReport if the value is declared in another unit (.pas) ?
I had tried many things but nothing works. Of course the first try was to put the name of the unit where I declared the value in the "uses" clause of the unit where the QReport is located. I try declaring the value in the "interface" section (it's logic, right ?), later in the "implementation" section (just for try), but ... it doesnt works.
QuickReport like any report generator works with text.
If you have a value, convert it to text and use a QRlabel. Use the caption property. Steven van Els
SAvanEls@cq-link.sr
Walter,
pls explain where your variable is.
You may want to place it in a table and then point to it in qr by setting dataset and the field value. Give more details...
yomyom
A different approach would be to pass the data your report needs as parameters. In the following snippet of code, I pass a year to my report.
try
if cbxYear.Text = '' then begin
MessageDlg('The Year Needs to be Selected', mtError, [mbok], 0);
cbxYear.SetFocus;
Exit;
end;
RPrEstBilled := TRPrEstBilled.Create(Application);
dmPrEstBilled := TdmPrEstBilled.Create(Application);
RPrEstBilled.Execute(StrToInt(cbxYear.Text));
finally
RPrEstBilled.Free;
dmPrEstBilled.Free;
end;
Put the unitname(Customer in your example) where your in the used of the form where you call the report, then
Put a QRLabel into the Title band and then
From the form where you show the report before show the report do:
QuickReport1.QRLabel1.Caption:=Customer.VariableName; Camilo Andrés Sánchez A.
Ingeniería de Sistemas
Pontificia Universidad Javeriana
Bogotá, Colombia
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.