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:
- 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
- This filter will be used to create the element list that will later be used to answer the prompt.
- Programmatically retrieve this filter in the code with the following simple call:
strFilterID = "853D3B9C4281F3572646C6A628AE18DC"
Set oFilter = MySource.FindObject(strFilterID, DssTypeFilter)
- Next, retrieve the attribute which is used in the element prompt:
strAttrID = "8D679D3511D3E4981000E787EC6DE8A4"
Set oAttribute = MySource.FindObject(strAttrID, DssTypeAttribute)
- Next, apply the filter to the attribute to populate the IDSSElements object:
Set oElements = oAttribute.GetFilteredElements(oFilter)
- 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
- 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)
- 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.......
- Close the prompt:
oPrompt.Closed = True
- 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)
- 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.