problem with "CreateAutoSearchCriteria"
Hello,
I am using version 6.02 under Delphi 5 and Interbase and have trouble
with the "CreateAutoSearchCriteria" command.
What I did :
I create an array of this record type to collect the filter criteria :
TReportParameter = Record
Pipeline : String[50];
Feld : String[50];
Operator : TppSearchOperatorType;
Wert : String[200]; // = Value
End;
I fill this array of record with the following statements:
Var Child : TReportdatenmodul;
Parameter : Array of TReportParameter;
Folder_ID : Integer;
begin
Setlength(Parameter,2);
Parameter[0].Pipeline := 'plRABUCH1';
Parameter[0].Feld :=
'Rechnung_am'; // field name in
query
Parameter[0].Operator := soGreaterThanOrEqualTo;
Parameter[0].Wert := InttoStr(Trunc(von)); // this is my
value, an integer number converted to string value
Parameter[1].Pipeline := 'plRABUCH1';
Parameter[1].Feld := 'Rechnung_am';
Parameter[1].Operator := soLessThanOrEqualTo;
Parameter[1].Wert := InttoStr(Trunc(bis));
Child := TReportdatenmodul.Create(nil);
Child.create_Report ('RABUCH',Folder_ID, Parameter);
FreeAndNil(Child);
And in my "create_report" method I do this :
procedure TReportdatenmodul.create_Report(Reportname: String; Folder_ID:
Integer; Parameter: array of TReportParameter);
VAR I : Integer;
begin
With ppReport DO
Begin
CachePages := False;
ppReportExplorer.LoadReport(Reportname, 1); // 1 is the
folder_ID
FreeAutoSearchFields;
For I := 0 To High(Parameter) DO
Begin
CreateAutoSearchCriteria(Parameter[I].Pipeline,
Parameter[I].Feld,
Parameter[I].Operator,
Parameter[I].Wert,
False);
End;
ShowAutoSearchDialog := False;
DeviceType := 'Screen';
ShowPrintDialog := False;
ShowCancelDialog := False;
PrinterSetup.Copies := 1;
Reset;
Print;
End; // WITH
end;
If I run this program, I always get empty reports. If I set these
filters in the "data" tab of reportbuilder, everything works perfectly
fine.
Are there any settings that I have forgotten to enable ?
Any help is welcome.
Thanks in advance
Thomas
____________________________________
GRID-DATA GmbH
Industriehof Trecknase 10
42897 REMSCHEID
GERMANY
mail : thomas.reppel@grid-data.com
phone : +49 2191 4701-0
fax : +49 2191 4701-26
please visit : www.grid-data.com
I am using version 6.02 under Delphi 5 and Interbase and have trouble
with the "CreateAutoSearchCriteria" command.
What I did :
I create an array of this record type to collect the filter criteria :
TReportParameter = Record
Pipeline : String[50];
Feld : String[50];
Operator : TppSearchOperatorType;
Wert : String[200]; // = Value
End;
I fill this array of record with the following statements:
Var Child : TReportdatenmodul;
Parameter : Array of TReportParameter;
Folder_ID : Integer;
begin
Setlength(Parameter,2);
Parameter[0].Pipeline := 'plRABUCH1';
Parameter[0].Feld :=
'Rechnung_am'; // field name in
query
Parameter[0].Operator := soGreaterThanOrEqualTo;
Parameter[0].Wert := InttoStr(Trunc(von)); // this is my
value, an integer number converted to string value
Parameter[1].Pipeline := 'plRABUCH1';
Parameter[1].Feld := 'Rechnung_am';
Parameter[1].Operator := soLessThanOrEqualTo;
Parameter[1].Wert := InttoStr(Trunc(bis));
Child := TReportdatenmodul.Create(nil);
Child.create_Report ('RABUCH',Folder_ID, Parameter);
FreeAndNil(Child);
And in my "create_report" method I do this :
procedure TReportdatenmodul.create_Report(Reportname: String; Folder_ID:
Integer; Parameter: array of TReportParameter);
VAR I : Integer;
begin
With ppReport DO
Begin
CachePages := False;
ppReportExplorer.LoadReport(Reportname, 1); // 1 is the
folder_ID
FreeAutoSearchFields;
For I := 0 To High(Parameter) DO
Begin
CreateAutoSearchCriteria(Parameter[I].Pipeline,
Parameter[I].Feld,
Parameter[I].Operator,
Parameter[I].Wert,
False);
End;
ShowAutoSearchDialog := False;
DeviceType := 'Screen';
ShowPrintDialog := False;
ShowCancelDialog := False;
PrinterSetup.Copies := 1;
Reset;
Print;
End; // WITH
end;
If I run this program, I always get empty reports. If I set these
filters in the "data" tab of reportbuilder, everything works perfectly
fine.
Are there any settings that I have forgotten to enable ?
Any help is welcome.
Thanks in advance
Thomas
____________________________________
GRID-DATA GmbH
Industriehof Trecknase 10
42897 REMSCHEID
GERMANY
mail : thomas.reppel@grid-data.com
phone : +49 2191 4701-0
fax : +49 2191 4701-26
please visit : www.grid-data.com
This discussion has been closed.
Comments
There is one that creates end user search criteria at runtime. Notice that
it creates the search criteria on the report, which creates criteria objects
in DADE and also autosearch fields on the report array. You can set the
autosearch fields like the demo does to modify the search values:
...
CreateAutoSearchCriteria;
ppReport1.AutoSearchFields[0].SearchExpression := 'C';
...
Cheers,
Jim Bennett
Digital Metaphors Corp.
http://www.digital-metaphors.com
info@digital-metaphors.com
thanks for your answer. I had a look at the demos and I could not find sth
different
to my implementation. If I run my report without setting any filter, it is fine.
If I set the filter
manually in the "data" section of RB, it works perfectly fine.
But when I use these CreateAutoSearchCriteria, I always get only one blank
record in my reports.
Is there something I forgot to enable ?
Thomas
"Jim Bennett (Digital Metaphors)" schrieb:
--
____________________________________
GRID-DATA GmbH
Industriehof Trecknase 10
42897 REMSCHEID
GERMANY
mail : thomas.reppel@grid-data.com
phone : +49 2191 4701-0
fax : +49 2191 4701-26
please visit : www.grid-data.com
everything is fine...
Thomas
"Jim Bennett (Digital Metaphors)" schrieb:
--
____________________________________
GRID-DATA GmbH
Industriehof Trecknase 10
42897 REMSCHEID
GERMANY
mail : thomas.reppel@grid-data.com
phone : +49 2191 4701-0
fax : +49 2191 4701-26
please visit : www.grid-data.com
autosearch values are getting created and see what the values are. Are you
sure you aren't filtering all of the data by accident? Try creating a
simple report emulating the end user create autosearch example, based on
DBDemos. Maybe there is a step that is being missed. By creating a simple
one from scratch you can be sure to go step by step and maybe see what is
not working. If that doesn't work, then send the demo to
support@digital-metaphors.com and we'll take a look at it.
Cheers,
Jim Bennett
Digital Metaphors Corp.
http://www.digital-metaphors.com
info@digital-metaphors.com