How to Get Query String Values from PeopleCode

In PeopleCode if you want to get the value from the Query String URL, the Request Class can be used. As you may know QueryString can be used to pass information from one page to another page (In the same component or a different component in the portal). Query string consists of the form of name-value pairs, such as EMPLID (name) = 12345678 (value). PeopleCode defines three methods to access the Query string parameter information.
  • GetParameter(name) - returns the value of a specified query string parameter or posted form data parameter.
  • GetParameterNames - returns all the parameter names for this request as an array of Strings, or an empty array if there are no input parameters
  • GetParameterValues(name) - method returns the values of the specified parameter (name) as an array of Strings, or an empty array if the named parameter does not exist. 

    as an example we can get the value of the EMPLID parameter from the query string as follows (assume that code is written in RowInit)

    Local string stringEMPLID = %Request.GetParameter("EMPLID");

    if EMPLID parameter returns multiple values then GetParameterValues() can be used as follows;

    Local Array of String &MYQueryParamValues;
    &MYQueryParamValues = GetParameterValues("EMPLID');
    for &i=1 to &MYQueryParamValues.Len Step 1
    Winmessage(&MYQueryParamValues[&i]);
    end-for;

    For more info please refer: http://docs.oracle.com/cd/E28394_01/pt852pbh1/eng/psbooks/tpcr/book.htm?File=tpcr/htm/tpcr23.htm#H4027

SHARE

Ayesha Wee

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment