Need variable from Delphi form in RAP
Hi,
On Form1 (in Delphi application) the end-user can select some options through
checkboxes.
One of these checkboxed is needed to show/hide a certain field on the report.
************************************
procedure TimesOnPrint;
begin
If Form1.cbTimesShow.Checked then
Times.Visible := True
else
Times.Visible := False;
end;
************************************
Is there a way to make the value of the checkbox "Form1.cbTimesShow.Checked"
available in RAP?
Regards,
Stef
On Form1 (in Delphi application) the end-user can select some options through
checkboxes.
One of these checkboxed is needed to show/hide a certain field on the report.
************************************
procedure TimesOnPrint;
begin
If Form1.cbTimesShow.Checked then
Times.Visible := True
else
Times.Visible := False;
end;
************************************
Is there a way to make the value of the checkbox "Form1.cbTimesShow.Checked"
available in RAP?
Regards,
Stef
This discussion has been closed.
Comments
Yes, you can do so using report parameters. Take a look at the
Report.Parameters property and its topic in the RBuilder help. Also, below
is a small example of how it can be used with RAP.
http://www.digital-metaphors.com/tips/SimpleParameters.zip
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
That is exactly what I needed to know.
Regards,
Stef
I can't get it to work.
I've created parameter on ppReport1 as dtBoolean:
After pushing the Print-button I assign the value of MyCheckbox to it, like:
ppReport1.Parameters['cbToonTijden'].Value := MyCheckbox.Checked;
This is the code in RAP on the **SUB**-report field.
If Trunc(FacturenUITDetails['Datum']) = 0 then
Tijden.Visible := False
else
Tijden.Visible := ppReport1.Parameters['cbToonTijden'];
Do you have any suggestions? What am I missing?
Regards,
Stef
Error in RAP:
Undeclared identifier ppReport1.
Regards,
Stef
In RAP you do not need to use the Delphi name of the report. Simply use
"Report".
Report.Parameters[...
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Well still no luck.
procedure TijdenOnPrint;
begin
If Trunc(FacturenUITDetails['Datum']) = 0 then
Tijden.Visible := False
else
Tijden.Visible := Report.Parameters['cbToonTijden'];
end;
Error: Expected '(' or '[' but found 'Parameters' instead.
Regards,
Stef
Could it be because I try using it on a ppChildReport1 (subreport)?
And if so, how can I access the parameter from the ppChildReport1, as the
ppChildReport1 doesn't have it's own parameters property?
Regards,
Stef
I got it.
procedure TijdenOnPrint;
var HoofdRapport : TppReport;
begin
HoofdRapport := TppReport(Report.MainReport);
If Trunc(FacturenUITDetails['Datum']) = 0 then
Tijden.Visible := False
else
Tijden.Visible := HoofdRapport.Parameters['cbToonTijden'];
end;
Thanks for all the help.
Stef