Home DADE
New Blog Posts: Merging Reports - Part 1 and Part 2

Passing variables from delphi 7 pro

edited May 2003 in DADE
Hi

I have a report in which the end user can use an autosearh list to limit a
report to transactions after a certain date. To do this he picks > or >= to
a date.
When this occurs I have a procedure in a Delphi 7 program which then checks
the search operator and then puts the autosearch.value into a local variable
within my procedure. I then change the search criteria from > date to all
dates and I want to pass the original autosearch value back into the report
where I can use the variable to hide certain detail bands.

Here is the structure of my delphi unit that concerns what I am doing.

TDReports = class(TDBase)
rep: TppReport;
procedure repBeforePrint(Sender: TObject);

//---------------------------------------------------------------
procedure TDReports.repBeforePrint(Sender: TObject);
begin
inherited;

if rptFileName = 'CstStm.brp' then
DataByDate;

end;

//----------------------------------------------------------------
procedure TDReports.DataByDate;
var
GetDate : String;
begin

If rep.AutoSearchFields[0].SearchOperator = soGreaterThan or
rep.AutoSearchFields[0].SearchOperator = soGreaterThanOrEqualTo then
begin
GetDate := rep.AutoSearchFields[0].Value;
if (rep.AutoSearchFields[0].FieldName = 'IssueDate') then
rep.AutoSearchFields[0].SearchExpression := '';
end;

end;
//-----------------------------------------------------------------

How do I pass the string variable "GetDate" back into the report
"CstStm.brp" so I can use it in the BeforePrint event in the report itself
and how do I pick up this variable in the report?

Allan Ryan

Comments

  • edited May 2003
    Try using a one field / one record count JITPipeline to get the value back
    "into" the report. This way you can code event handlers that reference
    ppJITPipeline1['GetDateFieldName'] to perform operations with the string
    variable from your Delphi code in your RAP code.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.