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

Hiding Parameter window

edited March 2011 in General
Hello,
I'm running Delphi XE and RB 12.03, and I'm looking to programmatically set
a parameter at runtime, which is to be used in an autosearch field within
the data source. Is there a way to not present the user with the parameter
entry dialog (the one titled 'Search') that pops up before printing? I'm
calling the report with the following code.

ppReport1.Template.FileName := 'C:\Templates\Temp1.rtm';
ppReport1.Template.LoadFromFile;
ppReport1.Parameters['pID'].Value := Prod.id;
ppReport1.Print;

Given then I'm setting the parameter to the desired value, I don't want the
user to see this dialog. Is there a way around that?
Thank you,
-Steve Shanbaum

Comments

  • edited March 2011
    Hi Steve,

    If the parameter is tied to an AutoSearch field, then it is the
    Autosearch dialog you are seeing. You can control this dialog using the
    Report.ShowAutoSearchDialog property.


    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2011
    Hi Nico,

    Thank you for your response. I've since changed my code to
    ppReport1.Template.FileName := 'C:\Templates\Temp1.rtm';
    ppReport1.Template.LoadFromFile;
    ppReport1.Parameters['pID'].Value := Prod.id;
    ppReport1.ShowAutoSearchDialog := False;
    ppReport1.Print;

    However, I'm still being presented with the Autosearch dialog. Is there a
    characteristic about the parameter itself I need to change, or possibly its
    use? In the Search tab of the data pipeline, both Autosearch and Mandatory
    are checked (though unchecking Mandatory simply changes the Autosearch
    dialog to make it optional).

    Though it looks like unchecking the Autosearch option prevents the dialog
    from opening, while still constraining the records in the data pipeline to
    the desired result set. Is that what I should have been doing all along, or
    should setting the ShowAutoSearchDialog to false indeed prevent the
    Autosearch dialog from appearing in the above instance?

    Thank you again,
    -Steve

  • edited March 2011
    Hi Steve,

    Yes you are correct and I misspoke.

    When using Parameters, if you have the AutoSearchSettings.Enabled
    property set to True, the AutosearchDialog will display regardless.
    Setting the Enabled property to False will prevent the dialog from
    displaying even though it is still possible to link the parameter to an
    autosearch field.

    Likewise this works from DADE as well as you found by unchecking the
    AutoSearch option. This however will also remove the autosearch option
    from the preview window if needed.


    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.