Parse query from URL

This tip describes how to parse a query string from the URL in a form using a CGI server variable.

Sometimes you need to parse a query string from the URL right in the form. One solution is to use a CGI server

variable.




  1. Create a new computed when composed text field called query_string containing itself -- query_string. It causes a Web server to input content of the CGI Web server query_string variable (everything beyond the ? in the URL).
  2. Then create a new computed for display only multi-value text field called "parameters," for instance. This field should contain the following @Formula:
    @Explode(@Right
    (query_string; "&"); "&")
    
    This separates all name=value type sequences into multi-value ones and omits the URL commands beyond the ?.
  3. Then create two new computed for display multi-value text fields called "ParamNames" and "ParamValues," for instance, and containing the following @Formulas:
    @Word(Parameters; "="; 1) 
    and 
    @Word(Parameters; "="; 2)
    
    There are split values from names.
  4. Then it's possible to search for a particular name in ParamNames using:
    @If(@IsMember("Required_Name";
     ParamNames); @Subset(@Subset
    (ParamValues; @Member
    ("Required_Name"; ParamNames)); -1); 
    "Not present")
Function will return then the appropriate value or "Not present" (or anything else if you change it), if "key" name is not present in the URL. You can upgrade functionality by converting names to upper- or lowercase to avoid name variations. None of those fields, except query_string, will be saved, but this could be handled in web_query_save agent then.

Do you have comments on this tip? Let us know.

This was first published in November 2003

Dig deeper on Lotus Notes Domino Formula Language

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close