GETPARAMETER()

From Lianjapedia
Revision as of 05:48, 12 May 2021 by Yvonne.milne (Talk | contribs)

Jump to: navigation, search

Purpose

Function to return the value of a parameter passed to a .rsp script or return an alternative value if the parameter was not passed

Syntax

GETPARAMETER(<expC1>, <expC2>)

See Also

FUNCTION, GETMEMBER(), GETSESSIONVAR(), PARAMETERS, PARAMETERS(), PCOUNT(), PROCEDURE, RETURN, SET PROCEDURE, STR_QUOTEARGS()

Description

The GETPARAMETER() function is used in .rsp scripts to return the value of a parameter passed to a .rsp script or return an alternative value if the parameter was not passed. Parameters are read from the _request dynamic array, which contains the keys and values from the URL request. The name of the parameter is specified in <expC1>. An alternative value for the parameter is specified in <expC2> and this will be read if the parameter is not passed.

Note: the STR_QUOTEARGS() function (from v6.1) can be used to place quotes around each item in a comma separated list, so is particularly useful when parsing such parameters.

Example

// WebView URL Attribute
quickreport.rsp?database=southwind&table=example&fields=*&heading=Client List (all)&columns=2,4,3,5,6,7,8,9,10,11,12&subtotals=9,10,11&gridlines=true
 
//--
// quickreport.rsp?parameter=value&parameter=value...
//
// parameters 
//--
private database   = getParameter("database", "southwind") 
private table      = getParameter("table", "example") 
private fields     = getParameter("fields", "*") 
private groupby    = getParameter("groupby", "") 
private heading    = getParameter("heading", "Report for all clients by state") 
private headings   = getParameter("headings", "") 
private filter     = getParameter("filter", "") 
private hyperlink  = getParameter("hyperlink", "") 
private columns    = getParameter("columns", "") 
private subtotals  = getParameter("subtotals", "") 
private gridlines  = getParameter("gridlines", "")
// ...