Automatically fill in auto search parameters

edited December 2006 in Server
Hello,

I would like to be able to automatically fill in auto search parameters from
the web without knowing anything about the underlying report. For example,
when I know a city and postal code in my web application I would like to
pass these to the web tier without knowing if there are autosearch fields
for city and postal code and without knowing anything about the report's
auto search fields from the web application.

Does a tutorial or document exist explaining how to implement this?

Thanks in advance,
Mariella

Comments

  • edited December 2006

    - there are three types of parameters are supported. Session Parameters,
    Report Parameters, AutoSearch Parameters.

    - check out the example referenced in the code below. Also check out the
    RBServer online help topics for TrsWebTier and TrsWebRequest.



    -------------------------------------------------------
    Tech Tips: RB Server and Custom Parameters
    -------------------------------------------------------

    The RBServer Custom Parameter demos show how to define custom session and
    report level parameters that can be used to implement security and other
    types of custom processing.

    The are three projects that work together. Each project includes a
    ReadMe.doc and commented code.

    1. RBServer\Demos\Servers\Custom Parameters
    2. RBServer\Demos\WebTier\Custom Parameters
    3. RBServer\Demos\Clients\Custom Parameters


    The demos include examples of how to...

    1. Define Custom Session parameters.

    A custom login form is displayed. Based upon the login, the catalog of
    reports available to the user is filtered.

    2. Define Custom Report parameters

    A custom parameter form is displayed. The parameters are used by the report.

    3. Custom AutoSearch form

    A custom autosearch form is displayed. The parameter values are used by the
    autosearch criteria.





    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2006
    Hello Nard,

    Thanks for your answer. Unfortunately, it is not an answer to my question. I
    do not want to implement custom parameters and I know how to display an auto
    search form. What I'd like is to be able to automatically fill in values for
    auto search values without knowing anything about the report. Let's look at
    an example which might be the exact case:

    - A report with autosearch values 'company' and 'department' exists.
    - The (web) client is currently handling a data record which contains fields
    'employeeid', 'job title', 'department', 'location', 'start date'

    In this case I want the report to show up with 'department' already filled
    in with the value of the record the client is currently handling. The client
    does not know anything about the autosearch values of the report (The client
    even does not know if the report uses auto search values).

    Is there an easy way to implement this behaviour?

    Kind regards,
    Mariella

  • edited December 2006

    The Custom Parameters Demo shows how to handle autosearch parameters in
    addition to session and report parameters. It does /not/ show how to do
    exactly what you describe, because it shows the user a custom autosearch
    form. However, I think it does show how to create a TrsWebRequest object and
    call WebTier.GetAutosearchParameters(aWebRequest) to retrieve the autosearch
    parameters from the server. Then you can update the
    WebRequest.AutoSearchParameters and call WebTier.ProcessRequest(aWebRequest)
    to generate the report.

    In the RBServer\Demos\WebTier\Custom Parameters project...

    1. The TWebModule1.WebModule1waDefaultAction method shows how to create a
    TrsWebRequest object from the web broker TWebRequest QueryFields and
    Content.

    var
    lWebRequest: TrsWebRequest;
    begin

    {use the incoming request parameters to create a TrsWebRequest}
    lWebRequest := rsWebTier1.CreateWebRequest(Request.QueryFields,
    Request.Content);

    try
    Response.Content := ProcessDefaultRequest(lWebRequest);

    finally
    lWebRequest.Free;
    end;

    2. Once you have a TrsWebRequest object you can call the
    WebTier.GetAutoSearchParameters(aWebRequest) method to retrieve the
    autosearch parameters from the server. They will be placed in the
    WebRequest.AutoSearchParameters collection.

    3. At this point you can update the parameter values for the
    WebRequest.AutoSearchParameters

    4. Call WebTier.ProcessWebRequest(aWebRequest) to generate the report.

    Have a look at theses methods in the demo

    - TWebModule1.ProcessDefaultRequest
    - TWebModule1.ProcessAutoSearchRequest
    - TWebModule1.GetAutoSearchParametersPage


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2006
    Hello Nard,

    Thanks. Using GetAutoSearchParameters I now have it working. Now only one
    issue left : When using GetAutoSearchParameters the auto search dialog is
    not shown, causing auto search parameters which have not been filled in to
    show all, even when they are required. Is there a way to force an auto
    search parameters screen on startup after filling in defaults?

    Kind regards,
    Mariella

  • edited December 2006

    Try this....

    // change requested content to the search form
    myWebRequest.ContentParameters['content'].Value := 'searchform';

    myWebTier.ProcessWebRequest(myWebRequest);



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2006
    Hello Nard,

    When I do it that way the search form shows up, but without any fields. When
    I click the "Search" button (the only control) I get the report and only
    when I press the search button after that I get a normal search form.

    Kind regards,
    Mariella

  • edited December 2006
    Is it possible what I want?

    Kind regards,
    Mariella

  • edited December 2006
    Hi Nard,

    As my colleague replied earlier, this suggestion only works partially.
    The search dialog now shows up without any search fields. We are
    waiting to deliver a project until this problem is solved. So far RB
    has served all our needs, hopefully we can solve this one as well.
    Hoping to hear from you soon


    regards
    Paul Sjoerdsma

    On Fri, 15 Dec 2006 10:53:48 -0600, "Nard Moseley \(Digital
  • edited December 2006

    Here is an example that shows how to set default autosearch field values
    from the webtier and have them displayed in the autosearch dialog.

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

    :)

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2006
    Thanks for your example Nard.

    In my application it does not work correctly. The lSession variable is
    always nil when first requesting a report. I tried to create a session
    manually like:

    if (lSession = nil) then
    begin
    sSessionDir := rsWebTier.CacheDirectory;
    if (sSessionDir[Length(sSessionDir)] <> '\') then
    sSessionDir := sSessionDir + '\';
    sSessionDir := sSessionDir + Req.SessionID;
    ForceDirectories(sSessionDir);
    lSession := TrsWebSession.Create(Req.SessionID, sSessionDir,
    scNew);
    end;

    I still get the same result. I get a search form only containing a button
    "Search" whereby the filled in auto search parameters get lost. When I
    remove

    Req.ContentParameters['content'].Value := 'searchform';

    the old behaviour occurs : The auto search values get filled in, but the
    dialog gets skipped. Do you have any suggestions? I can send you the source
    code if it may help..

    Kind regards,

    Mariella Bakker
    P&A Group


  • edited December 2006

    - if you have not done so already, first try running the exact example
    project that I posted. It works in my testing here

    - perhaps in your application you are not using the report explorer
    interface? I think in the example that I posted, the SessionId is assigned
    when the report explorer is first displayed, so by the time the user chooses
    a report, the SessionId exists.

    - try modifying the example to call GetSessionForRequest rather than
    GetSessionForID. Calling GetSessionForRequest can handle returning a new
    session or an existing session as needed.

    Example:

    lSession := gWebSessionManager.GetSessionForRequest(aWebRequest);




    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2007
    Hi Nard,

    Using GetSessionForRequest did the trick. It is working correctly now at the
    customers site.

    Thanks a lot!

    Kind regards,
    Mariella

  • edited January 2007

    Great news - glad to hear it is working :)

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

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