Using the Intelligence Server SDK provided in Strategy 10.x, it is possible to programmatically execute a report, answer any prompts, and create/update a report history list message.
In this example, a report with an element prompt will be executed and create a history list message for the current user.
Dim MyDataSource As New DSSDataSource
Dim MyProject As DSSDataSource
Dim MyProjectList As DSSDataSourceEnumerator
Dim MySession As IDSSSession
Dim MySource As DSSObjectServer
Dim oRepSource As IDSSReportSource2
'Define Intelligence Server Connection Information
MyDataSource.Type = EnumDSSDataSourceType.DssDataSourceTypeServer
MyDataSource.Location = "INTELLIGENCE SERVER NAME OR IP"
MyDataSource.Mode = EnumDSSConnectionMode.DssConnectionModeServerAccess
MyDataSource.AuthMode = EnumDSSAuthModes.DssAuthStandard
MyDataSource.login = "USERNAME"
MyDataSource.Passwd = "PASSWORD"
MyDataSource.Init()
'Find the project
MyProjectList = MyDataSource.Enumerator
MyProject = MyProjectList.ItemByProjectName("PROJECT NAME")
MyProject.Init()
'Create the session
MySession = MyProject.CreateSession
MySource = MySession.Component(EnumDSSComponentRole.DssRoleObjectSource)
oRepSource = MySession.Component(EnumDSSComponentRole.DssRoleReportSource)
'Retrieve an existing Filter object created in either Developer or Web 10.x
Dim strFilterID As String
Dim oFilter As IDSSFilter
strFilterID = "FILTER GUID HERE"
oFilter = MySource.Source.FindObject(strFilterID, EnumDSSObjectType.DssTypeFilter)
'Retrieve an existing Attribute object tied to the elements defined in the filter object
Dim strAttrID As String
Dim oattribute As IDSSAttribute5
strAttrID = "ATTRIBUTE GUID HERE"
oattribute = MySource.Source.FindObject(strAttrID, EnumDSSObjectType.DssTypeAttribute)
'Filter the elemnts of the attribute based on the filter object
Dim oElements As IDSSElements2
Dim oElement As IDSSElement
oElements = oattribute.GetFilteredElements(oFilter)
'Retrieve an existing report object
Dim reportDef As IDSSReportDefinition
Dim oRepInst As IDSSReportInstance16
Dim strReportID As String
Dim oRes As IDSSResolution
Dim oPrompt As IDSSPrompt
Dim answerList As IDSSElements2
'Retrieve the report definition, report instance, then the resolution
strReportID = "REPORT GUID HERE"
reportDef = MySource.Source.FindObject(strReportID, EnumDSSObjectType.DssTypeReportDefinition)
oRepInst = oRepSource.NewInstance(reportDef)
oRes = oRepInst.Resolution
'The resolution object contains the collection of prompts in the report instance. After creating the resolution object, it will still need to be populated, then after that, instantiate the IDSSPrompt object:
'The following example assumes there is only 1 prompt. This prompt can have or not have default prompt answers.
Call oRes.Resolve(oRepInst.Definition)
oPrompt = oRes.Item(1)
'Create the prompt answer list object and populate it with the elements from the filtered list of elements, oElements
answerList = oPrompt.Answer
For Each oElement In oElements
answerList.Add(oElement)
Next oElement
oPrompt.Closed = True
'Create a new report instance, passing in the resolution object and original report definition again
Dim objReportInstance As IDSSReportInstance
objReportInstance = oRepSource.NewInstance(reportDef, oRes)
'Then execute the report using the new report instance (that contains the modified resolution object) and setting all the appropriate flags:
oRepSource.Execute(objReportInstance, EnumDSSReportActions.DssActionExecuteAll, EnumDSSReportFlags.DssReportCreateInBoxMsg)