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

KB7330: How to Create a HTML Document Object in MicroStrategy Intelligence Server SDK 9.x


Community Admin

• Strategy


IDSSDocumentDefinition is the API interface to use when creating a new document object with the MicroStrategy Intelligence Server SDK 9.x. Three methods are offered to populate contents of the document object.

IDSSDocumentDefinition is the API interface to use when creating a new document object with the Strategy Intelligence Server SDK 9.x. Three methods are offered to populate contents of the document object.

  • IDSSDocumentDefinition::Populate
    Populate contents of document object from existing IDSSDocumentDefinition interface (as from another existing document object)
     
  • IDSSDocumentDefinition::PopulateFromXML
    Populate contents of document object from XML DOM object that contains information about this document object's contents
     
  • IDSSDocumentDefinition::PopulateFromXMLString

Populate contents of document object from XML string that contains information about this document object's contents
 
The following is an eXtensible Markup Language (XML) string example on how document contents should be defined:
 


<doc>
    <di dt="1" />
    <does>
        <de det="3" dem="1" deb="0" eid="1" deid="AF76BB6411D424EEC000D8906B98494F" />
        <de det="3" dem="1" deb="0" eid="2" deid="216F12EE11D424F5C000D8906B98494F" />
        <de det="3" dem="1" deb="0" eid="3" deid="AF76BD5111D424EEC000D8906B98494F" />
    </does>
    <dl dlr="3">
        <dlf>\SampleDocument.html</dlf>
    </dl>
</doc>

 


 

Its corresponding long format XML is the following:
 

<doc> 
    <document_info data_type="1" /> 
    <doc_elements> 
        <doc_element doc_elem_type="3" document_element_mode="1" document_element_banding="0" doc_elem_id="1" doc_elem_dssid="AF76BB6411D424EEC000D8906B98494F" /> 
        <doc_element doc_elem_type="3" document_element_mode="1" document_element_banding="0" doc_elem_id="2" doc_elem_dssid="216F12EE11D424F5C000D8906B98494F" /> 
        <doc_element doc_elem_type="3" document_element_mode="1" document_element_banding="0" doc_elem_id="3" doc_elem_dssid="AF76BD5111D424EEC000D8906B98494F" /> 
    </doc_elements> 
    <doc_layout dlr="3">  
         <doc_layout_file>\ SampleDocument.html 
     </doc_layout> 
</doc>

 
Two basic pieces of information are included in this XML string. First comes the involved report Globally Unique Identifier (GUID) (doc_elem_dssid); then comes the Hyper Text Markup Language (HTML) layout file name (doc_layout_file). The HTML layout file includes the eXtensible Stylesheet Language (XSL) names applied to each report in document object as shown below:
 

<HTML> 
    <HEAD> 
        <META NAME="GENERATOR" content="Microsoft DHTML Editing Control"> 
        <TITLE></TITLE> 
    </HEAD> 
    <BODY> 
         <P> 
            <IMGeid="1" xsl="C:\Program Files\MicroStrategy\Desktop\XSLs\Agent.xsl "> 
            <IMG eid="2" xsl="C:\Program Files\MicroStrategy\Desktop\XSLs\BlueAndGrey.xsl "> 
            <IMG eid="3" xsl="C:\Program Files\MicroStrategy\Desktop\XSLs\Classic.xsl " </P> 
     </BODY> 
</HTML>

 
The code below illustrates the usage of API calls mentioned above:
 

'========================================== 
' Create a new DataSource 
Dim MyDataSource As New DSSDataSource 

MyDataSource.Type = DssDataSourceTypeServer 
MyDataSource.Location = "APS_SDK" 
MyDataSource.Mode = DssConnectionModeServerAccess 

'-------------------------------------------------- 
' Login into a project... 

MyDataSource.AuthMode = DssAuthStandard 
MyDataSource.login = "Administrator" 
MyDataSource.Passwd = "" 
MyDataSource.Init 

'-------------------------------------------------- 
' Find a project in the DataSource 
Dim MyProjectList As DSSDataSourceEnumerator 
Dim MyProject As DSSDataSource 
Dim ProjectName As String 

Set MyProjectList = MyDataSource.Enumerator 
Set MyProject = MyProjectList.ItemByProjectName("VMall") 

'-------------------------------------------------- 
' Initialize the project. 
MyProject.Init 

'-------------------------------------------------- 
' Create a session object. 
Dim MySession As IDSSSession 
Dim MySource As IDSSSource 
Set MySession = MyProject.CreateSession 
Set MySource = MySession.Component(DssRoleObjectSource) 

'-------------------------------------------------- 
'Search for parent folder where new document will be created under 
Dim mySearch As IDSSSearch 
Dim myParentFolder As IDSSFolder 
Dim rootFolder As IDSSFolder 

Set mySearch = MySource.NewObject(DssTypeSearch) 
mySearch.NamePattern = "Reports" 
mySearch.Domain = DssSearchRepository 
mySearch.Types.Add DssTypeFolder 

Set myParentFolder = mySearch.Execute 
Set rootFolder = myParentFolder.Item(1) 

'-------------------------------------------------- 
'Create a new document object 
Dim MyDocument As IDSSDocumentDefinition 
Dim MyDocumentInfo As IDSSObjectInfo 

Set MyDocumentInfo = MySource.NewObject(DssTypeDocumentDefinition) 
MyDocumentInfo.Name = "Newdocument" 
Set MyDocumentInfo.Parent = rootFolder 

Set MyDocument = MyDocumentInfo.Special 

Call MyDocument.PopulateFromXMLString("<doc><di dt=""1""/> <does><de det=""3"" dem=""1"" deb=""0"" eid=""1"" deid=" "AF76BB6411D424EEC000D8906B98494F""/><de det=""3"" dem=""1"" deb=""0"" eid=""2"" deid=""216F12EE11D424F5C000D8906B98494F""/><de det=""3"" dem=""1"" deb=""0"" eid=""3"" deid=""AF76BD5111D424EEC000D8906B98494F""/> </does><dl dlr=""3""><dlf>\NewDocument.html</dlf ></dl></doc>") 

MyDocument.Info.Save 

'=================================================== 
' Close session when finished 
If Not MySession Is Nothing Then 
MySession.Close 
End If 
Set MySession = 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