GetSessionLog Method

Official Content

Syntax

GAMRepository.GetSessionLogs(in:GAMSessionLogFilter,out:GAMError Collection) : GAMSessionLog Collection


Description

This method returns all the sessions defined in the repository where the application is connected to.
It receives as a parameter a variable based on GAMSessionLogFilter external object which allows setting the filters for the search (date range, Initial IP Address, Status, UserGUID, isAlive, etc).
It returns a collection of GAMSessionLog object which contains all the information on the session.
If any error is thrown by the method's execution, it can be handled by the second parameter of the method which is based on GAMError collection data type.

Example 1

&GAMSessionLogFilter.DateFrom  = &DateFrom
&GAMSessionLogFilter.DateTo  = &DateTo
&GAMSessionLogFilter.EndedFrom  = &EndedFrom
&GAMSessionLogFilter.EndedTo  = &EndedTo
&GAMSessionLogFilter.Limit   = &SessionsXPage
&GAMSessionLogFilter.Start = (&CurrentPage-1) * &GAMSessionLogFilter.Limit + 1

For &GAMSessionLog in GAMRepository.GetSessionLogs(&GAMSessionLogFilter, &Errors)
      &GAMSessionToken  = &GAMSessionLog.Token
      &GAMuserGUID   = &GAMSessionLog.User.GUID
      &name     = &GAMSessionLog.User.Name
Endfor

Example 2

The following example will return the list of the alive sessions. Note that the status of the session has to be active and the isAlive property must be true.

&GAMSessionLogFilter.Status   = GAMSessionStatus.Active
&GAMSessionLogFilter.isAlive   = True

For &GAMSessionLog in GAMRepository.GetSessionLogs(&GAMSessionLogFilter, &Errors)
      &GAMSessionToken  = &GAMSessionLog.Token
      &GAMuserGUID   = &GAMSessionLog.User.GUID
      &name     = &GAMSessionLog.User.Name
Endfor