EsbGetCalcList() gets the list of calc script objects that are accessible to a user. The progammer needs to use EsbGetNextItem() to access the list of available scripts.
EsbGetCalcList (hCtx, UserName, AppName, DbName, isAllCalcs, pItems)
ByVal hCtx As Long
ByVal UserName As String
ByVal AppName As String
ByVal DbName As String
isAllCalcs As Integer
pItems As Integer
| hCtx | Essbase VB API context handle. |
| UserName | User name. |
| AppName | Application name. |
| DbName | Database name. If an empty string, uses Application sub-directory |
| isAllCalcs | Integer that contains the AllowAllCalcs flag. If AllowAllCalcs is set to ESB_FALSE, the user can access all calc script objects. Otherwise, the user can only access those script objects specified in the CalcList argument. |
| pItems | Integer that contains the count of available calc script objects. |
If successful, returns sts=0 and returns the user's AllowAllCalcs setting in pAllCalcs. If isAllCalcs is equal to ESB_FALSE, pItems contains the count of the available calc script objects. Access the list of calc script object names with EsbGetNextItem().
If isAllCalcs is equal to ESB_TRUE, then pItems will return 0 and the programmer will need to call a combination fo EsbListObjects() (using type ESB_OBJTYPE_CALCSCRIPT) and EsbGetObjectInfo() for each returned object.
This function requires the caller to have Database Design privilege (ESB_PRIV_DBDESIGN) for the specified database, unless they are getting their own calc list.
Declare Function EsbGetCalcList Lib "ESBAPIW" (ByVal hCtx As Long, ByVal User As String, ByVal AppName As String, ByVal DbName As String, AllCalcs As Integer, Items As Integer) As Long
Sub ESB_GetCalcList()
Dim Items As Integer
Dim AppName As String
Dim DbName As String
Dim User As String
Dim AllCalcs As Integer
Dim ObjName As String * ESB_OBJNAMELEN
Dim sts As Long
Dim ObjType As Long
Dim ObjectInfo As ESB_OBJINFO_T
ObjType = ESB_OBJTYPE_CALCSCRIPT
AppName = "Sample"
DbName = "Basic"
User = "test_user" ' Has 'calculate' access to Sample->Basic
' If user passed in has access to everything,
' then Items will ALWAYS be set to '0'!
' In that case, use EsbListObjects()
' (of type ESB_OBJTYPE_CALCSCRIPT, and
' then EsbGetObjectInfo()!
sts = EsbGetCalcList(hCtx, User, AppName, DbName, AllCalcs, Items)
If AllCalcs = ESB_NO Then
frmMain.lstInfo.AddItem "Number of calc script items returned: " & Items
frmMain.lstInfo.AddItem "--------------------------------------------------"
For n = 1 To Items
sts = EsbGetNextItem(hCtx, ESB_OBJNAME_TYPE, ByVal ObjName)
If sts <> 0 Then MsgBox "Failure in EsbGetNextItem(): " & sts: Exit Sub
sts = EsbGetObjectInfo(hCtx, ObjType, AppName, DbName, ObjName, ObjectInfo)
If sts <> 0 Then MsgBox "Failure in EsbGetObjectInfo(): " & sts: Exit Sub
frmMain.lstInfo.AddItem ObjectInfo.Name
frmMain.lstInfo.AddItem ObjectInfo.Type
frmMain.lstInfo.AddItem "----------"
Next
Else
frmMain.lstInfo.AddItem "You need to call EsbListObjects of type ESB_OBJTYPE_CALCSTRIPT"
End If
End Sub
EsbListObjects()