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

KB12475: How to Execute a Prompted Report and Create a Cache and History List Message Using MicroStrategy Intelligence Server SDK 9.x and 10.x


Community Admin

• Strategy


Using the Intelligence Server SDK provided in MicroStrategy 9.x and 10.x, it is possible to programmatically execute a report, answer any prompts, and create/update a report cache and history list message.

Using the Intelligence Server SDK provided in Strategy 9.x, it is possible to programmatically execute a report, answer any prompts, and create/update a report cache and history list message.
 
In this example, a report with an element prompt will be executed, creating a report cache or updating an existing one, and creating a history list message for the current user. Follow the steps below:
 

  1. Create a filter in Strategy Desktop 9.x defined like the following:
    {Call Center} = Atlanta,San Diego,San Francisco,Washington, DC,Salt Lake City,Fargo or Memphis
  2. This filter will be used to create the element list that will later be used to answer the prompt.
     
  3. Programmatically retrieve this filter in the code with the following simple call:
    strFilterID = "853D3B9C4281F3572646C6A628AE18DC"
    Set oFilter = MySource.FindObject(strFilterID, DssTypeFilter)
  4. Next, retrieve the attribute which is used in the element prompt:
    strAttrID = "8D679D3511D3E4981000E787EC6DE8A4"
    Set oAttribute = MySource.FindObject(strAttrID, DssTypeAttribute)
  5. Next, apply the filter to the attribute to populate the IDSSElements object:
    Set oElements = oAttribute.GetFilteredElements(oFilter)
  6. The next steps performed should be to get the report definition, report instance, then the resolution object from the report instance.
    Dim reportDef As IDSSReportDefinition
    Set reportDef = MySource.FindObject(strReportID, DssTypeReportDefinition)
    Set oRepInst = oRepSource.NewInstance(reportDef)
    Set oRes = oRepInst.Resolution
  7. The resolution object contains the collection of prompts in the report instance. After creating the resolution object in step 5, it will still need to be populated, then after that, instantiate the IDSSPrompt object:
    Call oRes.Resolve(oRepInst.Definition)
    Set oPrompt = oRes.Item(1)
  8. Next create the prompt answer list object and populate it with the elements created in step 4.
    oPrompt.Answer = Nothing
    Set oPromptAnswerList = oPrompt.Answer
    For.......loop
    oPromptAnswerList.Add oElements.Item(i)
    next.......
  9. Close the prompt:
    oPrompt.Closed = True
  10. Next create a new report instance, passing in the resolution object and original report definition again:
    Dim objReportInstance As IDSSReportInstance
    Set objReportInstance = oRepSource.NewInstance(reportDef, oRes)
  11. Then execute the report using the new report instance (that contains the modified resolution object) and setting all the appropriate flags:
    oRepSource.Execute objReportInstance, DssActionExecuteAll + DssActionAllCache, DssReportCacheDefault + DssReportRunSynch + DssReportUpdateAllCache + DssReportCreateInBoxMsg

Code 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 may not be able to provide additional code on this matter even though this customization is provided at this time for this specific build.
 


Comment

0 comments

Details

Knowledge Article

Published:

June 22, 2017

Last Updated:

October 13, 2017