Mstr Sdk Report

mstr-sdk

Re-run a report from history list:

https://community.microstrategy.com/t5/SDK/TN37428-How-to-run-a-report-saved-in-History-List-using/ta-p/187666

Re-run a report from cache:

https://community.microstrategy.com/t5/SDK/TN36012-How-to-Delete-an-Individual-Report-Cache-using-the/ta-p/186407
http://www.bryanbrandow.com/2011/05/purging-element-caches-with-the-java-sdk.html

Create report:

https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/objbeans/Creating_a_Report_with_a_report_Filter_On_It.htm?Highlight=report
https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/objbeans/Creating_a_new_report,_adding_a_metric_and_attribute.htm?Highlight=report

https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/objbeans/Report_Bean.htm?Highlight=report
https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/objbeans/Converting_a_Report_to_a_Data_Mart_Report_and_Saving_the_Report_Definition.htm?Highlight=create%20report
https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/writeback/WB_Creating_a_Freeform_SQL_Report_to_be_Writeback_Enabled.htm?Highlight=create%20report
https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/objbeans/Retrieving_a_report_instance.htm?Highlight=report
https://community.microstrategy.com/t5/SDK/TN38234-How-to-save-and-overwrite-a-report-using-the/ta-p/188401

Extracting data:

http://community.microstrategy.com/t5/tkb/articleprintpage/tkb-id/sdk/article-id/1835
http://www.microstrategysdkbooster.com/2012/03/reading-reports-data.html
https://lw.microstrategy.com/msdz/MSDZ_World2015/docs/projects/WebSDK/output/HTML5/default.htm#topics/scenarios/Retrieving_Report_XML_in_a_Custom_Format.htm
https://lw.microstrategy.com/msdz/MSDL/10/docs/ReferenceFiles/com/microstrategy/web/beans/RWBean.html
https://lw.microstrategy.com/msdz/MSDZ_World2015/docs/ReferenceFiles/com/microstrategy/web/beans/ReportBean.html
https://lw.microstrategy.com/msdz/MSDL/931/CustomizationPlugins/AdvancedScenarios/RetrievingReportXMLCustomFormat/src/com/microstrategy/sdk/samples/transforms/CustomXMLReportTransform.java

https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/objbeans/Report_Transform_example.htm?Highlight=report
https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/objbeans/Report_Data.htm?Highlight=report
https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/objbeans/The_Grid_Object_Model.htm?Highlight=report
https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/objbeans/Examples_for_report_manipulations.htm?Highlight=report
https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/objbeans/Report_Execution_and_Data_Retrieval.htm?Highlight=report
https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/objbeans/Retrieving_a_report_instance.htm?Highlight=report
https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/objbeans/Obtaining_Report_Objects_using_object_filtering_and_incremental_fetch.htm?Highlight=report
https://lw.microstrategy.com/msdz/MSDL/_CurrentGARelease/docs/projects/WebSDK/default.htm#topics/scenarios/WEBSDK086.htm?Highlight=report
http://community.microstrategy.com/t5/tkb/articleprintpage/tkb-id/sdk/article-id/276

Exporting:

https://community.microstrategy.com/t5/SDK/TN13843-How-to-Export-to-MS-Excel-with-Formatting-using/ta-p/174359
https://community.microstrategy.com/t5/MicroStrategy-Software/Java-SDK-Export-Report-to-PDF/td-p/240586
https://community.microstrategy.com/t5/MicroStrategy-Software/What-is-the-difference-between-EnumWebReportExecutionModes-and/td-p/248160
EnumDSSXMLDocExecutionFlags
EnumDSSXMLExecutionFlags
https://community.microstrategy.com/t5/tkb/articleprintpage/tkb-id/sdk/article-id/1470
https://community.microstrategy.com/t5/SDK/TN44870-How-to-Programmatically-Export-a-Document-to-Flash-Using/ta-p/194596

Pagination:

http://community.microstrategy.com/t5/MicroStrategy-Software/Customizing-Pagination-using-SDK/td-p/131632

Getting the SQL statement:

http://community.microstrategy.com/t5/Architect/TN3964-How-to-view-the-SQL-generated-by-MicroStrategy-SQL/ta-p/165573
http://community.microstrategy.com/t5/Object-Development/Can-we-change-Microstrategy-Generated-SQL/td-p/49377
http://community.microstrategy.com/t5/SDK/TN12851-How-to-retrieve-report-SQL-without-executing-the-report/ta-p/173415
http://community.microstrategy.com/t5/MicroStrategy-Software/Intelligent-Server-SDK-code-to-retrieve-Report-SQL/td-p/222777
https://lw.microstrategy.com/msdz/MSDZ_World2015/docs/ReferenceFiles/com/microstrategy/web/objects/rw/RWDataSetDetails.html
https://lw.microstrategy.com/MSDZ/MSDZ_World2015/docs/ReferenceFiles/com/microstrategy/web/objects/rw/RWDetails.html
https://lw.microstrategy.com/msdz/MSDL/10/docs/WebAPI_doclava/reference/com/microstrategy/web/objects/rw/RWDetails.html
https://lw.microstrategy.com/msdz/MSDL/902/docs/ReferenceFiles/com/microstrategy/web/objects/rw/RWDocumentDetails.html
http://community.microstrategy.com/t5/Administration/Displaying-sql-query/td-p/68576

Transforming reports:

https://lw.microstrategy.com/msdz/MSDL/900/docs/Retrieving_Report_XML_and_Automatically_Logging_Out.htm
https://lw.microstrategy.com/msdz/MSDL/900/docs/Retrieving_Report_XML_in_a_Custom_Format.htm
https://lw.microstrategy.com/msdz/MSDZ_World2015/docs/ReferenceFiles/com/microstrategy/web/app/transforms/RWDetailsTransform.html
https://community.microstrategy.com/t5/SDK/TN43407-How-to-Transform-the-ReportBean-Programmatically-with-a/ta-p/193224

Adding dataset:

https://community.microstrategy.com/t5/SDK/TN47331-How-to-Programatically-Add-a-Dataset-to-a-Document-using/ta-p/196966

Adding panel stack:

https://community.microstrategy.com/t5/tkb/articleprintpage/tkb-id/sdk/article-id/1422

Adding attributes to a report:

http://community.microstrategy.com/t5/SDK/TN263821-How-to-Dynamically-Add-Attributes-to-a-Report-Using-the/ta-p/263821
https://community.microstrategy.com/t5/MicroStrategy-Software/can-we-add-an-attribute-to-existing-reports-using-MSTR-SDK/td-p/131843
https://community.microstrategy.com/t5/MicroStrategy-Software/How-to-add-attribute-to-Report-Object-at-runtime-using-SDK/td-p/227830
https://community.microstrategy.com/t5/SDK/TN46419-How-to-Add-Attribute-Forms-to-a-Report-Services-Document/ta-p/196077
See microstrategy-sdk-addons for an example.

Getting attributes from a report?

https://community.microstrategy.com/t5/SDK/TN6179-How-to-obtain-attribute-s-column-information-from-a/ta-p/167236

Running a report and sending it to history list:

https://community.microstrategy.com/t5/SDK/TN46469-How-to-Send-a-Report-to-History-List-Programmatically/ta-p/196126

Answering prompts:
https://community.microstrategy.com/t5/tkb/articleprintpage/tkb-id/sdk/article-id/1444

Other:

https://community.microstrategy.com/t5/tkb/articleprintpage/tkb-id/sdk/article-id/1444 - how to answer a nested object prompt consisting of any number of element prompts and value prompts
https://community.microstrategy.com/t5/tkb/articleprintpage/tkb-id/sdk/article-id/1668 - TN200990: How to Execute a Report Services Document
https://community.microstrategy.com/t5/MicroStrategy-Software/How-to-execute-a-document-using-WEB-SDK-and-cache-it/td-p/46581
https://community.microstrategy.com/t5/tkb/articleprintpage/tkb-id/sdk/article-id/1766
https://community.microstrategy.com/t5/SDK/TN17624-How-to-get-the-raw-values-for-a-metric-within-a-dataset/ta-p/177923
https://community.microstrategy.com/t5/tkb/articleprintpage/tkb-id/sdk/article-id/464

How can we answer prompts?

//create new RWBean:
RWBean rwb = (RWBean)BeanFactory.getInstance().newBean("RWBean");     
rwb.setSessionInfo(serverSession); 

//get the instance, answer prompts, make sure status is ready
//set document ID   
rwb.setObjectID(documentID);
RWInstance rwi = rwb.getRWInstance();
rwi.setAsync(false);
rwi.pollStatus();
int status = rwi.getStatus();

WebPrompts prompts = rwi.getPrompts();
prompts.populateAnswers(promptAnswerXML);
prompts.validate();
prompts.answerPrompts();

int newStatus = rwi.pollStatus();

Code for running the report from the history list:

public static void main(String[] args) {
    WebObjectsFactory webobjFactory = WebObjectsFactory.getInstance();
    WebIServerSession session = webobjFactory.getIServerSession();
    session.setServerName("localhost");
    session.setLogin("Administrator");
    session.setPassword("");
    session.setProjectName("MicroStrategy Tutorial");

    BeanFactory beanFactory = BeanFactory.getInstance();
    ReportBean rb = (ReportBean)beanFactory.newBean("ReportBean");
    rb.setSessionInfo((WebSessionInfo)session);

    String objID = "3655302942D12B38CB1823AE2F48618F";
    rb.setExecutionFlags(EnumDSSXMLExecutionFlags.DssXmlExecutionSaveToInbox);
    rb.setObjectID(objID);

    GetHistoryList obj = new GetHistoryList();
    // Send to HL and get the message ID. (Year = 2009)

    String msgID = obj.saveHL(rb);

    // Change the filter definition while the thread stops.

    try {
        Thread.sleep(60000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    try {
        rb.refresh();
    } catch (WebBeanException e1) {
        e1.printStackTrace();
    }

    // Send to HL with the different filter. (Year = 2008)
    obj.saveHL(rb);

    //Get the history list message.
    if (msgID != null) {
        WebReportSource wrs = session.getFactory().getReportSource();
        try {
            WebReportInstance wri = wrs.getInstance(msgID);
            obj.RunHL(wri);
        } catch (WebObjectsException e) {
            e.printStackTrace();
        }
    }

    try {
        session.closeSession();
    } catch (WebObjectsException e) {
        e.printStackTrace();
    }
}

public String saveHL(ReportBean reportBean) {
    try {
        reportBean.collectData();
        return reportBean.getMessageID();
    } catch (WebBeanException e) {
        e.printStackTrace();
        return null;
    }
}

public void RunHL(WebReportInstance wri){
    OutputGrid(wri);
}

This is the formatted code from https://community.microstrategy.com/t5/SDK/TN37428-How-to-run-a-report-saved-in-History-List-using/ta-p/187666

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License