WebGet

See Also: WebSet Get, Set

Purpose

Retrieves a web property.

Syntax

WebGet PropertyName [of Object] to Variable

Argument Explanation

PropertyName The name of the property whose value to retrieve.

Variable The variable to retrieve the value of PropertyName into.

What It Does

For a web application to perform useful work, it is necessary to have persistent data that can be accessed from one server call to the next. This is accomplished using web properties.

Web Properties can be of type Client, Server or ServerSession.

For more information about Web Properties, see Web Properties.

Note that RowId data-types are not supported for any type of web property, including structs and arrays. If you need to store RowIds, serialize them to a string using the SerializeRowId() function.

 

Declaring Web Properties

A property is declared as a Web Property via the WebProperty Meta Data Tag. Only properties of the cWebObject class (or a subclass) can be tagged as Web Properties.

You cannot WebGet or WebSet a property unless it is defined as a Web Property.

 

This declares a property as a Client Web Property:

{ WebProperty=Client }

Property String psLabel ""

This declares a property as a Server Web Property:

{ WebProperty=Server }

Property String psLabel ""

This declares a property as a Server Session Web Property:

{ WebProperty=ServerSession }

Property String psLabel ""

 

Example

To access the current value of the psValue property of a cWebForm after a user in a specific client session has changed that value, you must use WebGet.

Correct:

Procedure DoSomething

    String sValue

 

    WebGet psValue of oWebForm1 to sValue

End_Procedure

If you were to use Get instead of WebGet, you would retrieve the initial value of the property, rather than the current value of that property in the running client session.

Wrong:

Procedure DoSomething

    String sValue

 

    Get psValue of oWebForm1 to sValue

End_Procedure

 

Note

WebGet does not delegate. If you are in a child object and need to access a property of a parent object (e.g. cWebView) via WebGet, you must use the object name to WebGet the value:

WebGet psValue of oMyWebView to sValue

To view the current value of a Web Property in the Studio's Watches Window, use the _WP debugger function.