EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB7021: How to Turn on Project Statistics in MicroStrategy Intelligence Server SDK 9.x


Community Admin

• Strategy


In MicroStrategy Desktop, statistics can be turned on for each project following the steps in this article.

 
In Strategy Desktop, statistics can be turned on for each project following below steps:

  • Step 1. Create a Statistics Table using the Strategy Configuration Wizard, if this is not done yet.
  • Step 2. Choose the Statistic Database instance from 'Statistics' tab in Project Configuration.
  • Step 3. Enable the statistics logging for the project.
  • Step 4. Choose the individual modules to be logged.
  • Step 5. Restart the Strategy Intelligence Server to make the new settings take effect.

 
In Strategy Intelligence Server SDK 9.x, the corresponding API calls to achieve the related steps above are:

  • IDSSProjectReference::StatisticsDBRole
     
    The StatisticsDBRole is a DSS Database Role object. A database role object denotes the usage of a database in some situation. In this case, the database role object tells the server how to establish the RDBMS connection that it uses to log statistical information about the usage of this project. The statistics can, then, be analyzed to determine the information about the whole project is used.
     
    This property defaults to 'Nothing'. It is permitted to set it to 'Nothing'.
     
    
    HRESULT get_StatisticsDBRole(
         IDSSDBRole ** ppStatisticsDBRole
    );
    
    HRESULT putref_StatisticsDBRole(
        IDSSDBRole * pStatisticsDBRole
    );

     
    In Parameters:
    pStatisticsDBRole: The pointer to the IDSSDBRole interface.
     
    Out Parameters:
    ppStatisticsDBRole: The pointer to the IDSSDBRole interface.
     
    Return Values:
    S_OK
     
    Remarks:
    None
     
  • IDSSProjectReference::Setting
     
    The setting is a parameterized Variant property. It is used to record a large number of settings used by the server when running this specific project. The settings may be numbers, text strings or Boolean values. The server-project settings can be grouped into three categories: startup setting, runtime setting and governors.
     
    
    HRESULT get_Setting (
         EnumDSSServerProjectSettingID SettingID,
         VARIANT *pSettingValue
    );
    
    HRESULT put_Setting (
         EnumDSSServerProjectSettingID SettingID,
         VARIANT SettingValue
    );

     
    In Parameters:
    SettingID: The parameter identifying the setting being read or written. It must be in the range zero to SettingCount minus one.
     
    SettingValue: The new value for the setting.
     
    Out Parameters:
    PSettingValue: The existing value for the setting.
     
    Return Values:
    S_OK
     
    E_INVALIDARG: SettingID was not a value from the enumeration.
     
    Remarks:
    The enumeration EnumDSSServerProjectSettingID lists the valid settings.
     
  • IDSSProjectReference::StatisticSetting
     
    The StatisticSetting is a parameterized Boolean property. Each property represents a statistic about the project, or usage of the project that the server could collect. Set the property to 'True' to start collecting the corresponding statistic for the project. The settings are grouped together into static modules that relate to similar topics.
     
    
    HRESULT get_Setting (
        EnumDSSServerProjectSettingID SettingID,
        VARIANT *pSettingValue
    );
    
    HRESULT put_Setting (
        EnumDSSServerProjectSettingID SettingID,
        VARIANT SettingValue
    );

     
     
     
    In Parameters:
    ModuleID: The enumeration value representing the statistic module.
     
    DataID: The enumeration value representing the specific statistic in question.
     
    SettingValue: The new value for the setting.
     
    Out Parameters:
    PSettingValue: The existing value for the setting.
     
    Return Values:
    S_OK
     
    E_INVALIDARG: Either the ModuleID was not a value in its enumeration, the DataID was not a value in its enumeration or the DataID value was not from the module referenced by ModuleID.
     
    The following is a code sample on how to turn on project's document statistics. Please note that the program will report errors if the Step 1 mentioned above is not done properly.
     


'==================================================
'Specify the name of the DataSource to use.
Const DataSourceName As String = "SDK_Demo"

'These constants are the user's credentials for the project.
Const gLogin As String = "administrator"
Const gPassword As String = ""

''==================================================

'Create a new DataSource
Dim MyDataSource As New DSSDataSource
On Error Resume Next
MyDataSource.Type = DssDataSourceTypeServer
MyDataSource.Location = "APS_SDK"
MyDataSource.Mode = DssConnectionModeServerAccess

'-----------------------------------------------------------------------------------------

' Login into data source
MyDataSource.AuthMode = DssAuthStandard
MyDataSource.login = gLogin
MyDataSource.Passwd = gPassword
MyDataSource.Init

'--------------------------------------------------------------------------------

'Create a session and connect to configuration
Dim objSession As IDSSSession
Set objSession = MyDataSource.CreateSession
Dim mobjObjSource As IDSSSource
Set mobjObjSource = objSession.Component(DssRoleConfigurationSource)

'--------------------------------------------------------------------------------

' Locate Iserver definition
Dim oConfigRoot, oServDef As IDSSFolder
Dim oServ As IDSSServerDef
Dim oProject As IDSSObjectInfo
Set oConfigRoot = mobjObjSource.Configuration.Root
Set oServDef = oConfigRoot.Item("Server Definitions").Special
Set oServ = oServDef.Item("APS_SDK")

'---------------------------------------------------------------------------------


'Search for the DB Role that will be used for statistics
Dim MyFolder As IDSSFolder
Dim MyDBRole As IDSSDBRole
Dim ObjSearch As IDSSSearch

'--------------------------------------------------

'Initialize a search object.
Set ObjSearch = mobjObjSource.NewObject(DssTypeSearch)
ObjSearch.NamePattern = "VMall"
ObjSearch.Types.Add (DssTypeDBRole)
ObjSearch.Domain = DssSearchRepository
Set MyFolder = ObjSearch.Execute
Set MyDBRole = MyFolder.Item(1)

'-----------------------------------------------------------------------------------

'Set statistics DB instance for project
Set oServ.ProjectReferences.Item("My First Project").StatisticsDBRole = MyDBRole

'-----------------------------------------------------------------------------------

'Turn on statistics setting
oServ.ProjectReferences.Item("My First Project").Setting(DssServerProjectCollectStatisticsFlag) = 1

'-----------------------------------------------------------------------------------

'Define statistic module adopted
oServ.ProjectReferences.Item("My First Project").StatisticSetting(DssStatisticModuleDocument, DssStatisticDataIDReserved) = True

'-----------------------------------------------------------------------------------

' Save Iserver definition
oServ.Info.Save

'===================================================

' Close session when finished

'---------------------------------------------------

'Close session object.
If Not objSession Is Nothing Then
  objSession.Close
End If

Set objSession = Nothing

'---------------------------------------------------

'Reset data source object.
If Not MyDataSource Is Nothing Then
  MyDataSource.Reset
End If
Set MyDataSource = Nothing

 
 
The example provided in this document is provided “as-is” and user has read the following customization warning:
ADDITIONAL INFORMATION:
The Strategy SDK allows you to customize several Strategy products and extend and integrate the Strategy business intelligence functionality into other applications. However, before changing the way Strategy products look or behave, it is helpful to understand how the application is built. For more information regarding the Strategy products or the process of customizing Strategy products, please refer to Strategy Developer Zone (https://developer.microstrategy.com).
To access the Strategy Developer Zone, you must have access to the Strategy Knowledge Base, you must have purchased the Strategy SDK, and you must be current on your Strategy maintenance agreement. If you are a US-based business and believe that you satisfy all three of these conditions but you do not have access to the Strategy Developer Zone, please contact Strategy Technical Support at support@microstrategy.com or at (703) 848-8700. If you are an international business, please contact Strategy Technical Support at the appropriate email address or phone number found at https://www.microstrategy.com/us/services/support/contact.
CUSTOMIZATION WARNING:
This customization is provided as a convenience to Strategy users and is only directly applicable to the version stated. While this code may apply to other releases directly, Strategy Technical Support makes no guarantees that the code provided will apply to any future or previous builds. In the event of a code change in future builds, Strategy Technical Support makes no guarantee that an updated version of this particular customization will be provided. In the event of a code change in future builds, Strategy may not be able to provide additional code on this matter even though this customization is provided at this time for this specific build. For enhancements to this customization or to incorporate similar functionality into other versions, contact your Account Executive to inquire about Strategy Consulting assistance.
 


Comment

0 comments

Details

Knowledge Article

Published:

March 31, 2017

Last Updated:

March 31, 2017