Equinox Online Help - Language Reference - A to Z

Home

RemoveAttachedUser

Applies to
SyntaxRemoveAttachedUsers UserConnectionId
ActionRemoves the attached user with the specified User connection id
ScopeUsable anywhere.
Notes

This statement allows users to be removed progamatically without the use of j-display. This is paticularly useful where access to the server is a problem.

CategoryClient - Server
See Also ConnectionID, FirstAttachedUser, IsNetwork, IsUserAttached, IsUserGroupAttached, NextAttachedUser
Example

Below is an example of how you might implement this into you application. Follow the instructions outlined in the knowledgebase article called ‘Before Logout, After Login’ to set up the system so that it maintains a currently connected user list.

Amend the procedure AutoExecBeforeLogout so that rather than recording the time a user logs out of the system, it deletes the user from the connections list as follows:

public procedure AutoExecBeforeLogout
string vsConnectionID

subtable UsrCon
setIndex UsrConIDgx
vsConnectionID = ConnectionId
FindRecord EQ, vsConnectionID

if not syserror then
DeleteRecord
end if
end subtable | UsrCon
end procedure | AutoExecBeforeLogout

Now your application should be maintaining an accurate connection list. To remove a selected user from the list (for example if they have become a Ghost user), add a new button to your form labelled ‘Remove User’.

Place the following code behind this new button:

string vsId

if IsNetwork=3 then
PopupFlags49
PopupTitle "Select user to remove"
PopupJustification 0, 0, 0
PopupColour black, colour17
PickColumnWidths 10, 10, 30
PickCaptions "ID", "Login Name", "Full Name"
PickFields UsrConnectionId, UsrConLogin, UsrName
vsId = Pick(UsrConnectionId,,UsrNamegx)

RemoveAttachedUser vsID

if syserror then
Alert "System was unable to remove user " & vsID & " - " & lookup(UsrName, UsrConnectionId, UsrConIDgx)
else
subtable UsrCon
SetIndex UsrConIDgx
FindRecord EQ, vsID

if not syserror then
DeleteRecord
end if
end subtable | UsrCon

Alert "User " & vsID & " - " & lookup(UsrName, UsrConnectionId, UsrConIDgx) & " Successfully removed"
end if
else
Alert "This is NOT a networked application."
end if

When you hit the button a pick list will appear with all the currently connected users in it.

Select the user you want to remove and hit return. You will see an alert telling you whether the removal was successful or not.