SetSelfLink – PB Docs 150

SetSelfLink method (DataWindows)

Description

Specifies the URL and page parameters for the current page
of the Web DataWindow.

Controls

DataWindow type

Method applies to

Web

Server component

Syntax

[Web DataWindow server component]

Argument

Description

dwcomponent

A reference to an Web DataWindow server
component.

selflink

The URL for the current page. It cannot
include parameters. Parameters may be added when HTML is generated.

Selflink is used to generate URLs for
navigation buttons that obtain additional rows from the result set
and for other buttons that reload the page, such as Update and Retrieve.

Sets the value of the HTMLGen.SelfLink property for the DataWindow
object associated with the server component.

selflinkargs

A string in the form:

Argname is a page parameter to be passed
to the server.

Exp is a DataWindow string expression
that is evaluated, converted using URL encoding, and used as the
value of argname in generated HTML.

The evaluated selflinkargs expressions
are included in the generated HTML as hidden fields. The arguments
supply information, such as retrieval arguments, that the server
needs to render additional pages of the result set.

Return Values

Returns an empty string if successful and the syntax error
message from the Modify method if it fails.

Usage

This method calls the Modify method of
the server component’s DataStore to set the property.

For information about using the Web DataWindow, see the DataWindow Programmers
Guide
.

Reason for self-link information

The first time the client browser requests the page template,
it can pass page specific information using GET or POST and
the page can use those values in the server-side scripts. However,
when the page is reloaded because of user interactions with the Web
DataWindow, that information will not be passed to the page automatically.

To make the information available, you specify a selflinkargs string
that becomes page parameters in the reloaded page. Typically, you
would use self-link parameters to provide:

  • Login
    information from another page

  • DataWindow object name

  • Retrieval arguments for the DataWindow object

Getting the URL for the page

To correctly reload the page in response to user actions,
the server component needs to know the URL of the page template.
You can get this information from the name property of the document
object header or the SCRIPT_NAME server variable.

In a JSP page, you must parse the return value from a request.getRequestURI call:

In ASP, use the ServerVariables method
of the Request object:

Self-link arguments for SetSelfLink

The syntax for specifying self-link arguments is:

The expression is a DataWindow expression that is evaluates
to a string. Usually, you will be passing constant string values
that have already been passed to the page as page parameters.

The expression is enclosed in quotes, and if the value is
a constant, it must also be enclosed in quotes. For example, if
a page parameter has the value Johnson, the
value of the expression must be enclosed in two sets of quote marks: '"Johnson"'.

To get the value from the current Logname parameter, which
is already defined for the page, you build the expression using
the Logname page parameter. The single quotes and inner double quotes
are embedded in the expression. The current value is inserted between
the quotes:

If the DataWindow object requires retrieval arguments, they
must be provided to the reloaded page in selflinkargs.
For an example of using SetSelfLink for setting
up retrieval arguments as page parameters, see Retrieve.

Examples

This server-side script specifies hyperlink information
for the page. The value of the empid column is stored in the page
parameter EMPID:

This hyperlink information refers to the JSP page by name.
The page is regenerated by calling the template again. There are
no link arguments:

This ASP example uses the ServerVariables method
of the Request object to get the SCRIPT_NAME variable:

In JSP you must parse the return value from a request.getRequestURI call. This
example also sets up a page parameter for the reloaded page using
the page parameter Logname:

See Also


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x