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

Autosearch in Webtier

edited July 2003 in Server
I'd like to control Autosearch parameters in the webteir the same way I'm
able to from a trsClientReport. I need to manipulate both what is displayed
in the autosearch dialog and validate what is entered after the user hits
the search button. I don't need a custom search page, only to be able to
manipulate the stock search page.

In the trsClientReport the events AfterAutoSearchDialogCreate and
OnReceiveAutoSearchFields do a good job of this. What's the best way to
gain access to these events from within the webtier?

Thanks!

Jon Gray

Comments

  • edited July 2003

    Its going to work differently on the WebTier. The WebTier custom parameters
    demo shows this.

    I will try to create an example that is more focused on what you describe.

    I am not sure whether it is possible to validate the search parameters
    without at least displaying a custom error page.


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2003

    This example shows how to initialize autosearch parameters on the
    webtier:

    http://www.digital-metaphors.com/tips/rbWebAutoSearchCustom.zip



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2003
    Thanks Nard - This solved the problem. I'm now able to manipluate the
    autosearch parameters in the webtier. This code loop allows me to traverse
    the autosearchfields just like in a trsClientReport.

    {add code to initialize the WebRequest.AutoSearchParameters here}
    for i:= 0 to aWebRequest.AutoSearchParameters.Count - 1 do
    for j :=0 to aWebRequest.AutosearchParameters[i].FieldCount - 1 do
    aWebRequest.AutoSearchParameters[i].Fields[j].


    Thanks again Nard - with this functionality in place my "fat-client
    trsClientReport" and "thin-client Web based" reporting work similarly. The
    fat-client has more bells and whistles like custom coded search dropdowns
    etc. While the web tier gets you to the same base report without all the
    bells and whistles. rbServer is REALLY the best of both worlds.

    Signed - A satisfied customer.


  • edited July 2003
    Spoke to soon I guess - having some trouble manipulating autosearch...


    I'd like to remove an autosearch field but keep it as a search criteria so
    it's still in the query but the user can't change the value.

    Something like this:

    aWebRequest.AutoSearchParameters[i].Fields[j].AutoSearch := false;


    Alas, the autosearch field still displays. I can manipulate the
    SearchExpression and ShowAll but not prevent the display of it altogether.
    Seems like this is a timing or refresh issue?




  • edited July 2003

    Search criteria created via the Data work space of the report designer can
    optionally be designated as AutoSearch criteria. By definition AutoSearch
    criteria are displayed in the AutoSearch dialog.
    I think what you are asking, is "How I can programmatically manipulate
    search criteria that is Not AutoSearch." AutoSearch criteria in a SQL Query
    creates a linked set of Report.AutoSearchFields[]. However for other search
    criteria, there are no such object accessible from the report. Therefore
    you will need to access the criteria in the TdaSQL object directly.
    Here is an example that shows how to do this.

    http://www.digital-metaphors.com/tips/UseNowDateForSearchCriteria.zip

    Note that the above example is for the report on the server. If you want to
    pass parameters between the server and webtier, you could define report
    parameters and then on the server side use the report parameter value to set
    the search criteria value.


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2003
    Not exactly.

    What I'm saying is I have a group of autosearch fields, one happens to be
    called "County Number". Half the time I want this Autosearch field to work
    normally. The other half of the time I want to programmatically set the
    searchexpression thus preventing the user from modifying the search for that
    field. When to display it or not is detemined at runtime based upon the
    value of another field.

    I'm kind of doing that now by suppressing the autosearch dialog display
    completely and setting all values programmatically when using a
    trsClientReport. What I really want is to conditionally stuff and suppress
    a single autosearch field (in this case county number) but still display the
    remaining autosearch fields.

    I would have thought doing this before the autosearch panel is displayed
    would have taken it off the autosearch list.


    "aWebRequest.AutoSearchParameters[i].Fields[j].AutoSearch := false;"


    I will take alook at your example, prehaps that is the only way I can get to
    the combination I need...



  • edited July 2003

    If you access the Criteria fields as shown in the example, you can perhaps
    set them to AutoSearch true/false, although timing wise I do not know
    whether this will work.

    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.