MicroStrategy ONE

Retrieving Report XML and Automatically Logging Out

This customization scenario provides sample code and instructions for retrieving the XML representation of a requested MicroStrategy report and automatically logging out after the data is retrieved. This is useful in cases where you have an external application from which you want MicroStrategy data to be quickly retrieved and presented statically, without leaving the MicroStrategy session on Intelligence Server open after the request is complete.

To satisfy this use case, you need a mechanism that logs you in to MicroStrategy Web, retrieves the data, and then automatically logs you out after the data is retrieved. This is accomplished using tasks from Tasks and Service-Oriented Architecture where you can use existing tasks to achieve your customization objective.

This customization can be accomplished as follows:

  1. Launch the Task Administrator application

  2. Click the Builder tab at the top. 

  3. Select reportDataService from the Task ID drop-down menu. 

  4. Select xml from the Task Envelope drop-down menu. 

  5. Select xml [Default] from the Task Content Type drop-down menu. 

  6. Enter appropriate values for the following parameters and check the Include box: server, styleName, project, userid, password and reportID. The values for the remaining parameters can be left blank or you can add values relevant to your customization. 

  7. Click the Update URL button to generate the URL. 

  8. Click the Invoke URL button to retrieve the Task Response. The following response is shown as an example.:\

    Copy
    <taskResponse statusCode="200">
    <report_data_list scp="1" crt="1297803184000"><report_data locc="GB" id="433CD21B4AD6168A2C952E985039CEE9" locid="2057" name="Units Sold, Revenue by Category" locl="en"><prs><pr v="0" n="LongNames" psn="Template Formatting"></pr><pr v="" n="VisProps" psn="Visualization"></pr></prs><objects><attribute rfd="0" id="8D679D3711D3E4981000E787EC6DE8A4" name="Category" type="12"><form rfd="1" id="8D6790CF11D3E4981000E787EC6DE8A4" base_form_type="2" name="ID" id_form="1" type="21"></form><form rfd="2" id="8D6790D211D3E4981000E787EC6DE8A4" base_form_type="3" name="DESC" type="21"></form></attribute><metric rfd="3" id="4C05190A11D3E877C000B3B2D86C964F" name="Units Sold" type="4"><format cat="0" cp="0" ts="-1" nn="1" dp="0" cs="$">#,##0</format></metric><metric rfd="4" id="4C05177011D3E877C000B3B2D86C964F" name="Revenue" type="4"><format cat="1" cp="0" ts="-1" nn="1" dp="0" cs="$">"$"#,##0</format></metric></objects><template><axis id="1"><unit rfd="0" unit_type="1"></unit></axis><axis id="2"><unit unit_type="3"><oi rfd="3"></oi><oi rfd="4"></oi></unit></axis></template><styles><style id="c17"><prs n="FormattingNumber"><pr v="1" n="Category"></pr><pr v="0" n="DecimalPlaces"></pr><pr v="-1" n="ThousandSeparator"></pr><pr v="$" n="CurrencySymbol"></pr><pr v="0" n="CurrencyPosition"></pr><pr v="&quot;$&quot;#,##0" n="Format"></pr><pr v="1" n="NegativeNumbers"></pr></prs></style><style id="c13"><prs n="FormattingNumber"><pr v="0" n="Category"></pr><pr v="0" n="DecimalPlaces"></pr><pr v="-1" n="ThousandSeparator"></pr><pr v="$" n="CurrencySymbol"></pr><pr v="0" n="CurrencyPosition"></pr><pr v="#,##0" n="Format"></pr><pr v="1" n="NegativeNumbers"></pr></prs></style></styles><raw_data><headers><oi rfd="0"></oi><oi rfd="3"></oi><oi rfd="4"></oi></headers><rows cn="4">
    <r fr="1"><v id="BB:8D679D3711D3E4981000E787EC6DE8A4:1:1:0:2:1">1</v><v>Books</v><v stid="c13">192,668</v><v stid="c17">$2,640,094</v></r>
    <r><v id="BB:8D679D3711D3E4981000E787EC6DE8A4:1:1:0:2:2">2</v><v>Electronics</v><v stid="c13">83,734</v><v stid="c17">$24,391,303</v></r>
    <r><v id="BB:8D679D3711D3E4981000E787EC6DE8A4:1:1:0:2:3">3</v><v>Movies</v><v stid="c13">287,517</v><v stid="c17">$4,098,943</v></r>
    <r><v id="BB:8D679D3711D3E4981000E787EC6DE8A4:1:1:0:2:4">4</v><v>Music</v><v stid="c13">283,554</v><v stid="c17">$3,893,367</v></r></rows></raw_data></report_data></report_data_list>
    </taskResponse>