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

KB32568: How to Modify the Properties Under Export Options for all the Reports Using the MicroStrategy Server SDK version 9.3.0?


Community Admin

• Strategy


Users can modify the properties listed under export options page that is displayed at the report level. In the sample code provided the following properties are modified "Export filter details" and "Remove extra column" as shown in the screen shot below,
 
 

ka04W000000Od7vQAC_0EM440000002GvA.png

 
 
 
 
Private MyProject As DSSDataSource
Private MyProjectList As DSSDataSourceEnumerator
Private MySession As IDSSSession
Private MySource As IDSSSource
Private oSession As IDSSSession
Private oObjSource As IDSSSource
Private strMessage As String
'This variable holds the currently selected report instance...
Private mobjRepInst As IDSSReportInstance
 
'This variables is the main report search object
Private objSearch As IDSSSearch
 
'This variable will hold the report objects returned by objSearch...
Private objReportFolder As IDSSFolder
 
'This variable holds the object source for the current selected project...
Private objObjSource As IDSSSource
 
'This variable holds the report source for the current selected project...
Private mobjRepSource As IDSSReportSource
 
'Variables holds a reports objectinfo interface...
Private objInfo As IDSSObjectInfo
'template object
Private oTemplate As IDSSTemplate
'Property Group
Private oPropGroup As IDSSPropertyGroup
'Property Set
Private oPropSet As IDSSPropertySet
'Propery
Private oProp As IDSSProperty
Private Sub Login_Click()
    Dim MyDataSource As New DSSDataSource
    On Error Resume Next
    MyDataSource.Type = DssDataSourceTypeServer
    MyDataSource.Location = Server.Text
    MyDataSource.Mode = DssConnectionModeServerAccess
   
    'log in to Project Source
   
    MyDataSource.AuthMode = DssAuthStandard
    MyDataSource.Login = User.Text
    MyDataSource.Passwd = pwd.Text
    MyDataSource.Init
      
   
    'Find the project
   
   
    Set MyProjectList = MyDataSource.Enumerator
    Set MyProject = MyProjectList.ItemByProjectName(Project.Text)
   
    ProjectName = MyProject.Name
    MyProject.Init
       
   
    'Create the session
   
    Set MySession = MyProject.CreateSession
    strOut "Login Successful. Project: " & ProjectName & ". Welcome " & MyDataSource.Login
   
End Sub
Private Sub strOut(str As String)
    strMessage = strMessage & vbCrLf & str
    result.Text = strMessage
End Sub
Private Sub SearchReports_Click()
    Dim strStatus As String
    Dim strDefault As String
    Dim strPath As String
   
    Dim strRptName, strRptID, strPrintln As String
    Dim rpt As Long  'rpt counter variable for outer-most loop
    'Create Report Definition to hold current report in folder
     
    Dim rptCount As Long
     
    Dim strPropName As String
   
    Dim objReptDefn As IDSSReportDefinition
   
    'Get the Object Source
    Set objObjSource = MySession.Component(DssRoleObjectSource)
       
    'Open/Create text file to store Report Names
    Open "reportIDs.txt" For Append As #1
   
    'set up new search object and define object type to search
    Set objSearch = objObjSource.NewObject(DssTypeSearch)
    objSearch.Types.Add DssTypeReportDefinition
    objSearch.Domain = DssSearchProject
    'objSearch.NamePattern = "Report1"
   
    'Execute search and store in a folder
    Set objReportFolder = objSearch.Execute
   
    'display status
    strOut ("Found " & objReportFolder.Count & " total reports.")
   
   
    'loop through each report in the folder
    For rpt = 1 To objReportFolder.Count Step 1
   
        'Store current report in variable
       
        Set objReptDefn = objReportFolder.Item(rpt)
        strRptID = objReptDefn.Info.ID
                                 
                    'write line to be put in file
                    strPrintln = strRptID
                   
                   'write the report info to the file
                    Print #1, strPrintln
                                                                           
    Next    'get next report
 
   
   
    Close #1
End Sub
 
Private Sub UpdateReportProps_Click()
Dim oRepDef As IDSSReportDefinition5
    Dim oTemplate As IDSSTemplate
    Dim oPGroup As IDSSPropertyGroup
    Dim oPSet As IDSSPropertySet
    Dim oP As IDSSProperty
    Dim oSource As IDSSSource
    Dim str As String
    Dim str2 As String
    Dim rptID As String
   
    Dim grpIndex As Long
   
    'Get the object source from the session
    Set oSource = MySession.Component(DssRoleObjectSource)
   
   
    'Open/Create text file to store Report Names
    'Open "C:\Update Report Properties Utility\reportIDs.txt" For Input As #1
    Open "reportIDs.txt" For Input As #1
    'Open/Create text file to print the updated and saved reports IDs and paths
    Open "debugresults.txt" For Append As #2
   
   
    'Loop through all the reports in the file
    Do While Not EOF(1)
   
    'Read the report Ids from file
    Input #1, rptID
   
    'Search for the report with ID rptID
    Set oRepDef = oSource.FindObject(rptID, DssTypeReportDefinition, DssSourceTotalObject)
   
    'Modify the export properties only if the view tamplate and template for the report found
    'are not empty 
    If Not oRepDef.Template Is Nothing Then
     If Not oRepDef.ViewTemplate Is Nothing Then
       oRepDef.ViewTemplate.Info.PropertySets("ExportProperties").Item("FilterDetails").Value = True
       oRepDef.ViewTemplate.Info.PropertySets("ExportProperties").Item("OverlapGridTitles").Value = 1
     End If
    oRepDef.Template.Info.PropertySets("ExportProperties").Item("FilterDetails").Value = True
    oRepDef.Template.Info.PropertySets("ExportProperties").Item("OverlapGridTitles").Value = 1
    ElseIf Not oRepDef.ViewTemplate Is Nothing Then
       oRepDef.ViewTemplate.Info.PropertySets("ExportProperties").Item("FilterDetails").Value = True
       oRepDef.ViewTemplate.Info.PropertySets("ExportProperties").Item("OverlapGridTitles").Value = 1
    End If
    str = "Report: " & oRepDef.Info.ID
 
    'Save the report after updating the properties
    Call oSource.SaveObject(oRepDef.Info)
 
    'Print out the modified report information to the debugResults file
    str2 = "Finish Saving: " & oRepDef.Info.ID & "-- Path: " & oRepDef.Info.Path & "-- Name: " & oRepDef.Info.Name
   
    Print #2, str, str2
 
    Loop
     
    'Close the files open for input
    Close #1
    Close #2
    strOut "Reports Updated"
End Sub
 
 
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:

June 23, 2017

Last Updated:

June 23, 2017