@UrlQueryString (Formula Language)

In a Web application, returns the current URL command and parameters, or the value of one of the parameters.

Note: This function is new with Release 6.

Syntax

@UrlQueryString( parameterName )

Parameters

parameterName

Text. Optional. The name of a parameter in the URL command.

Return value

query

Text or text list.

  • If the parameter is not specified, the return value is the URL command name (first list element) followed by the parameters (name, equal sign, value).
  • If the parameter is specified, the return value is the value of the parameter or null if the parameter does not exist.

Usage

@UrlQueryString is useful in formulas that run in the context of a browser.

This function can be used to compose dynamic DB2® query views in Web applications.

The Notes® client always returns null for this formula.

Examples

For the first two examples, the URL command is:
http://www.acme.com/marketing.nsf?OpenForm&ID=986574&Category=Golf
  1. This example:
    @UrlQueryString

    returns the list:

    • OpenForm
    • ID=986574
    • Category=Golf
  2. This example:
    @UrlQueryString("Category")

    returns the text:

    • Golf
  3. This code allows a DB2® Query View to be composed dynamically, by passing the Department information as part of the URL. To prevent SQL injection from the URL parameter, truncate at the first apostrophe, or if the data may contain apostrophes, escape your quotes using @ReplaceSubstring.
       URLParam := @UrlQueryString("Dept");
    Clause := @If( URLParam ="" ; "" ; " AND DeptName='"+ @Word(URLParam; "'"; 1) +"'");
       
       "SELECT D.DeptID , D.DeptName As DeptName , E.DeptID , E.Lastname AS Lastname FROM " + T1 +"  AS D, " + T2 + " AS E WHERE D.DeptID=E.DeptID" + Clause