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

KB238741: How To Bypass All Optional Prompts When Executing A Report Services Document Without Providing An Answer Using The MicroStrategy Web SDK


Community Admin

• Strategy


SUMMARY: There are many scenarios where the user only wants to access a report services document to retrieve the dataset objects. However, if the document being accessed contains prompts, it is not possible to bypass them without answering using an execution flag similar to reports. Nevertheless, if all the prompts on the document are optional, this is possible to be done with the Strategy Web SDK 9.4.1
The following sample code demonstrates how this is done:


 private static WebIServerSession serverSession = null;
    private static WebObjectsFactory factory = null;

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        factory = WebObjectsFactory.getInstance();
        serverSession = factory.getIServerSession();
        serverSession.setServerName("was-jpan");
        serverSession.setServerPort(0);
        serverSession.setProjectName("Strategy Tutorial"); 

        serverSession.setLogin("administrator"); // UserID
        serverSession.setPassword(""); // Password

        System.out.println(serverSession.saveState());

        // Initialize the session with the above parameters
        String docid = "BC8C829A4700640A27AF73802B333050";

        RWSource documentSource = factory.getRWSource();

        try {
            RWInstance rwi = documentSource.getNewInstance(docid);
            rwi.setAsync(false);
            //Bypass all option prompts using the answerPrompts method
            rwi.getPrompts().answerPrompts();
            rwi.pollStatus();
            RWDefinition rwd = rwi.getDefinition();
            RWDataSet dataset = null;
            for (int i = 0; i < rwd.getDataSets().size(); i++) {
                dataset = rwd.getDataSets().get(i);
                WebObjectInfo woi = dataset.getSourceObject();
                System.out.println("Dataset: " + woi.getDisplayName());
                System.out.println("Dataset ID: " + woi.getID());
                System.out.println("Dataset Type: " + woi.getType());

            }
        } catch (Exception e) {
            // TODO: handle exception
        }

    }

 
Note: If any of the prompts on the document are required and there are no default answers then this approach will not work
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:

June 22, 2017

Last Updated:

June 22, 2017