# EsbLROPurgeObjects

Description

EsbLROPurgeObjects() deletes all objects linked to cells in the active database for a given user name and/or modification date.

Syntax

    EsbLROPurgeObjects (hCtx, userName, purgeDate, PulCount)

    ByVal hCtx      As Long
    ByVal userName  As String
    ByVal purgeDate As Long
    ByVal PulCount  As Integer

Parameters

hCtx | Essbase API context handle.
userName | Pointer to a user name. If specified, deletes all objects last modified by the given user.
purgeDate | A modification date. If specified, deletes all objects modified on or before the given date. The date is a Long representing the number of seconds since January 1, 1970.
PulCount | Number of LRO catalog entries purged.

Return Value

If successful, returns ESB_STS_NOERR. Otherwise, returns an error code.

Notes

- If you specify both the userName and purgeDate parameters, objects meeting both criteria are deleted.
- EsbLROPurgeObjects() generates a list of the objects it deletes. After calling this function, use EsbGetNextItem() to retrieve information about each deleted object. The example code demonstrates how to do this.

Access

A call to this function requires design privileges (ESB_PRIV_DBDESIGN) for the data cell or the active database.

Example

    Declare Function EsbLROPurgeObjects Lib "esbapin" _
    (ByVal hCtx As Long, ByVal userName As String,  _
    ByVal purgeDate As Long, PulCount As Integer) As Long

    Public Sub ESB_LROPurgeObjects()

       Dim userName As String * ESB_USERNAMELEN
       Dim purgeDate As Long
       Dim Items As Integer
       Dim Desc As ESB_LRODESC_API_T
       Dim CutOffDate As Date
       Dim i As Integer

       Const ESB_REFERENCE_DATE = #1/1/70#
       userName = "admin"

       CutOffDate = #8/1/97#
       purgeDate = DateDiff("s", ESB_REFERENCE_DATE, _
                            CutOffDate)

       sts = EsbLROPurgeObjects(hCtx, userName, _
                                purgeDate, Items)

       If sts = 0 Then
          For i = 1 To Items
             '*******************************
             '* Get the next LRO description
             '* item from the list
             '*******************************

             sts = EsbGetNextItem(hCtx, ESB_LRO_TYPE, Desc)

          Next i
       End If

    End Sub

See Also

LRO Constant and Structure Definitions
EsbGetNextItem()
EsbLROGetCatalog()
EsbLRODeleteObject()
EsbLRODeleteCellObjects()