# EsbOtlGetMemberLastFormula

Description

EsbOtlGetMemberLastFormula() returns the last formula used to calculate the member.

Syntax

    EsbOtlGetMemberLastFormula (hOutline, hMember, pszFormula, usBufSize)

    ByVal hOutline   As Long
    ByVal hMember    As Long
    ByVal pszFormula As String
    ByVal usBufSize  As Integer

Parameters

hOutline | Outline context handle
hMember | Member handle.
pszFormula | Return variable for the member formula. The buffer is allocated by the caller, and the length is specified in the usBufSize parameter.
usBufSize | Size of the pszFormula buffer.

Return Value

The return value is zero if the function was successful.

Notes

- Use EsbFree() to free the formula buffer.
- This call will work for both EsbOtlOpenOutline() and EsbOtlOpenOutlineQuery().
- EsbOtlGetMemberLastFormula() returns the last formula applied to the selected member, which might differ from the Database Outline formula associated with that member.
- The last formula is derived from the last calculation (either from the outline or calc scripts) done on the member.

Example

    Declare Function EsbOtlGetMemberLastFormula Lib "ESBOTLN"
    (ByVal hOutline As Long, ByVal hMember As Long, ByVal pszFormula As String,
    ByVal usBufSize As Integer) As Long

    Sub ESB_OtlGetMemberLastFormula()
       Dim sts As Long
       Dim Object As ESB_OBJDEF_T
       Dim hOutline As Long
       Dim hMember As Long
       Dim szFormula As String * 100

       Object.hCtx = hCtx
       Object.Type = ESB_OBJTYPE_OUTLINE
       Object.AppName = "Sample"
       Object.DbName = "Basic"
       Object.FileName = "Basic"

       sts = EsbOtlOpenOutline(hCtx, Object, ESB_YES, ESB_YES, hOutline)

       If sts = 0 Then
          sts = EsbOtlFindMember(hOutline, "Margin", hMember)
       End If

       If sts = 0 And hMember <> 0 Then
          sts = EsbOtlGetMemberLastFormula(hOutline,
                hMember, szFormula, 100)
       End If

    End Sub

See Also

EsbFree() (in the main API)
EsbOtlDeleteMemberFormula()
EsbOtlGetMemberFormula()
EsbOtlOpenOutline()
EsbOtlOpenOutlineQuery()
EsbOtlSetMemberFormula()