BBjThinClient::getUserProperty

Description

In BBj 11.0 and higher, this method returns the value of a client-side property for a specified key within a specified client-side property group.

BUI logo

 See below.

Syntax

Return Value

Method

string

getUserProperty(long group, string key)

string

getUserProperty(string key)

Parameters

Variable

Description

group

  • USER_PROPERTIES_COOKIES (0)

  • USER_PROPERTIES_STORAGE (1)

  • USER_PROPERTIES_SESSION (-1)

key

The key of the property to be returned from the client.

Return Value

Returns the string value of the specified property.

Remarks

An !ERROR=11 will be thrown if  the specified key can not be found.

In BUI, USER_PROPERTIES_COOKIES maps to browser cookies, USER_PROPERTIES_STORAGE maps to browser local storage, and USER_PROPERTIES_SESSION maps to browser session storage.

In GUI, the three groups map to nodes in a Preferences tree, which doesn't allow keys or values to include any $00$ characters.

If no group is specified, the default value is taken from STBL("!USER_PROPERTIES").

Example 1

tc! = bbjapi().getThinClient()
tc!.setUserProperty("key","value")
print tc!.getUserProperty("key")

Example 2

rem 'Save a user property and set the cookie's expiration date for 90 days

group = System.currentTimeMillis()+1000*60*60*24*90
BBjAPI().getThinClient().setUserProperty(group, "myKey","myValue")

rem 'Read in the saved property
savedValue$ = BBjAPI().getThinClient().getUserProperty("myKey")
print "The saved property 'myKey' has a value of '", savedValue$, "'"
end

See Also

BBjAPI

BBjThinClient

BBjThinClient::setUserProperty

BBjThinClient::getUserProperties

BBjThinClient::setUserProperty

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.