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

What is the best way to pass parameters to a report.

edited January 2002 in General
Hi, I was wondering what was the best way to pass some parameters to my
reports. These parameters will be used to choose wich fields I will show in
my report. A TStringList would be the best type of parameter...

I already have a Data Pipeline connected to my report. So I guess I can't
use the TppJITPipeline object, unless we can connect many pipelines to one
report.If we can please let me know how.

Thanks in advance.

Yann St-Germain

Comments

  • edited January 2002
    Check out the installed Autosearch demos. There is detailed info on using
    the Autosearch feature in the report builder help file.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited January 2002
    Thanks allot for the info!!

    I was able to do what I wanted but is it good practice to pass non
    data-filtering parameters via AutoSearch? I do not get any errors saying
    that the criteria doesn't match any data. Will it cause me any problems in
    the futur?

    Here's what I was able to do:

    1- I pass my parameters from my application via CreateAutoSearchCriteria():
    {...}
    ppReport.CreateAutoSearchCriteria('Parameter001', 'Parameter001', soEqual,
    'MP1', False);
    ppReport.CreateAutoSearchCriteria('Parameter002', 'Parameter002', soEqual,
    'MP2', False);
    {...}

    2- I then can access them in RAP via Report.AutoSearchCriteriaByName() and
    do whatever I want with the parameter fields:
    procedure GlobalOnCreate;
    var
    xAutoSearchField: TppAutoSearchField;
    begin
    xAutoSearchField := Report.AutoSearchCriteriaByName('Parameter001',
    'Parameter001');
    DBText3.DataField := xAutoSearchField.Value;
    xAutoSearchField := Report.AutoSearchCriteriaByName('Parameter002',
    'Parameter002');
    DBText4.DataField := xAutoSearchField.Value;
    end;
  • edited January 2002

    Each data-aware control in RB has a datapipeline property and thus can
    be connected to a different datapipeline. Using a JITPipeline with a
    RecordCount of 1 is another good way to pass parameter info to a report.
    AutoSearch, as Jim suggested also works very well.




    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2002
    Thank you very much to both of you for your help!!!

    Both methods work fine, but I prefer doing it with a TppJITPipeline. I find
    it cleaner then with AutoSearch.

    By the way, I love your product!!! It's so much flexible!!!

    Thanks again.

    Yann St-Germain
This discussion has been closed.