Automatic Export Via URL API in MicroStrategy

MicroStrategy offers a lots of built in manipulations for the users that can directly be performed with the help or URL. With the help of this we can link MicroStrategy reports with other reports or from other system.

There are situations where we need to provide the link for exporting the documents/reports automatically with other details in different formats. Below are some explanations and sample for such URL API.

To get the correct starting URL, right click on a Report or Document in Web, choose Show Link, and copy the link from the top box.  (Note: This will use the internal machine name of your web server.  If you use a DNS name for Extranet access, you’ll instead want to go to Properties and copy the link from the bottom of that window).

The default URL you get will look like this:

http://webserver/Microstrategy/asp/Main.aspx?Server=ISERVER&Project=PROJECT&Port=0&evt=4001&src=Main.aspx.4001&visMode=0&reportID=19586093444B09A2D538C78EDB6BBEAE&reportViewMode=1

Step 1 – Update the Event ID

The first thing we’ll need to edit the event.  4001 is the event for running a report.  Below are some useful ones for our purposes that may be used :

·         3067 – Report – HTML,Excel, CSV & Plain Text

·         3062 – Report – PDF

·         3069 – Document – PDF, Excel, CSV & Plain Text

This Event ID needs to replace both &evt=4001 and &src=Main.aspx.4001.

Step 2 – executionMode update

Next, we need to add a parameter for the executionMode.  The different  options are :

·         3 – PDF

·         4 – Excel

·         7 – Flash

So, to export to Excel, it would be &executionMode=4

Step 3 – Default Export Options

To configure the options for user defined  export, simply run your Report or Document normally, export it from Web normally, and configure the export via the options.  Complete the export, then save the report.  The options you chose will be saved with it and used as the future defaults.

Once setup, add the parameter &showOptionsPage=false so that this page won’t display.

Note: If you want to export to Plain Text or CSV, follow the path to export to Excel (executionMode=4) and configure the file output option in your Default Export Options.

Step 4 – Clean up

You can remove the &visMode parameter and the &currentViewMode from your URL.  Those control the visualization and Grid/Graph mode respectively. If you want to leave this then it won’t have any problem.

The final URL will look something like

http://webserver/Microstrategy/asp/Main.aspx?Server=ISERVER&Project=PROJECT&Port=0&evt=3067&src=Main.aspx.3067&executionMode=4&showOptionsPage

This can be written different as well you are accessing internally in the reports/documents.

./mstrWeb?&Project={&PROJECT}&Server={&SERVERNAME}&Port=0&evt=2048001&src=mstrWeb. 2048001&documentID=7E85734311E6639100000080EF3514B3&visMode=0&promptsAnswerXML={&PROMPTXML}&originMessageID={&DOCUMENTMESSAGEID}&elementsPromptAnswers={&[Attribute Name]@GUID};={&[Attribute Name]@GUID}:value_1; {&[Attribute Name]@GUID}:value_1;value_2

originMessageID > This parameter is used to pass prompt answers from a source report/document to a target report/document.



Comments

Randy said…
If the report has a filter on it. How would you pass the filter. More specifically, a date range.