Xbasic

a5w_getExtendedUserInfo Function

Syntax

p Result = a5w_getExtendedUserInfo(userid as c)

Arguments

useridCharacter

The User Id to get information for from the Extended User Information Table.

Returns

ResultPointer

Returns a dot variable with the following properties:

errorLogical

If an error occurs, error will be .t.. Check the value of errorText to learn more about what error occurred. An error will occur if the Extended User Information Table has not been configured or if an error occurred while querying the database.

If no error occurs, this property will be .f..

errorTextCharacter

If an error occurs, contains information about the error encountered. See "Fixing Common Errors" below for info on how to fix known errors.

jsonCharacter

A JSON string containing the user info retrieved from the Extended User Information Table. This property will only be available if error is .f..

Description

Reads data from the Extended User Information table.

Discussion

The a5w_getExtendedUserInfo function retrieves information stored for a user in the Extended User Information Table.

Examples 

This basic example demonstrates reading data from the extended user information table for user id "john.smith@acme.com":

dim p as p
p = a5w_getExtendedUserInfo('john.smith@acme.com')

?p.error
= .f.

?p.json = <<%txt%
{
    "FIRSTNAME" : "John",
    "LASTNAME" : "Smith",
    "COMPANY" : "Acme Corp"
}

The next example demonstrates how you would get extended user information for the currently logged in user in an AjaxCallback:

function getUserInfo as c (e as p)
    dim userId as c = a5ws_GetCurrentUser()

    dim javascript as c = ""
    dim info as p
    info = a5w_getExtendedUserInfo(userId)

    if (info.error == .f.) then
        ' successfully got data
        javascript = "alert('"+js_escape(info.json)+"');"
    else
        ' an error occurred:
        javascript = "alert('Error occurred retrieving user data. Error was: "+js_escape(info.errorText)+"');"
    end if
    getUserInfo = javascript
end function

Fixing Common Errors 

A list of common errors and how to fix them are listed below:

See Also