MicroStrategy ONE
Special XML Cases
There are a number of special cases in the report grid XML that have to be considered for correct implementation of classes. These cases are discussed below.
Generating the page headers in a tree style
This is accomplished using DSSXmlResultPageTreeStyle in the result flags. This option generates the page headers in a tree style. That is, a hierarchy is set for each element. For example, if you execute a report that has Category, Metric, and Country as page headers, the elements for Metric and Country are defined for each element of Category. So selecting an element of Category displays only the relevant elements for Metric and Country. The following XML is generated:
<phs phss="1" cn="140">
<cmn>
Sell-Thru
</cmn>
<ph>
<h rfd="4" rs="1" csp="1" dpt="1" o="0" ui="1" ei="BB:8D679D3711D3E4981000E787EC6DE8A4:1:2:0:2:1:1:3:Electronics">
<fv sm="3">
Electronics
</fv>
<ph>
<h rfd="5" rs="1" csp="1" dpt="2" o="0" ui="2" ei="CD:4C051E2111D3E877C000B3B2D86C964F">
<fv sm="3">
Sell-Thru
</fv>
<ph>
<h rfd="6" rs="1" csp="1" dpt="3" o="0" ui="3" ei="BB:8D679D3811D3E4981000E787EC6DE8A4:1:2:0:2:1:1:3:USA">
<fv sm="3">
USA
</fv>
</h>
<h rfd="6" rs="1" csp="1" dpt="3" o="1" ui="3" ei="BB:8D679D3811D3E4981000E787EC6DE8A4:1:2:0:2:3:1:3:England">
<fv sm="3">
England
</fv>
</h>
</ph>
</h>
<h rfd="7" rs="1" csp="1" dpt="2" o="4" ui="2" ei="CD:4C05177011D3E877C000B3B2D86C964F">
<fv sm="3">
Sales
</fv>
<ph>
<h rfd="6" rs="1" csp="1" dpt="3" o="4" ui="3" ei="BB:8D679D3811D3E4981000E787EC6DE8A4:1:2:0:2:1:1:3:USA">
<fv sm="3">
USA
</fv>
</h>
<h rfd="6" rs="1" csp="1" dpt="3" o="5" ui="3" ei="BB:8D679D3811D3E4981000E787EC6DE8A4:1:2:0:2:3:1:3:England">
<fv sm="3">
England
</fv>
</h>
</ph>
</h>
</ph>
<h rfd="4" rs="1" csp="1" dpt="1" o="20" ui="1" ei="BB:8D679D3711D3E4981000E787EC6DE8A4:1:2:0:2:2:1:3:Food">
<fv sm="3">
Food
</fv>
<ph>
<h rfd="5" rs="1" csp="1" dpt="2" o="20" ui="2" ei="CD:4C051E2111D3E877C000B3B2D86C964F">
<fv sm="3">
Sell-Thru
</fv>
<ph>
<h rfd="6" rs="1" csp="1" dpt="3" o="20" ui="3" ei="BB:8D679D3811D3E4981000E787EC6DE8A4:1:2:0:2:1:1:3:USA">
<fv sm="3">
USA
</fv>
</h>
<h rfd="6" rs="1" csp="1" dpt="3" o="21" ui="3" ei="BB:8D679D3811D3E4981000E787EC6DE8A4:1:2:0:2:3:1:3:England">
<fv sm="3">
England
</fv>
</h>
As seen in this example, the page headers XML can differ significantly with DSSXMLResultPageTreeStyle as result flag. This is done because at times only some of the page headers can be related to each other. For example, if you have two page headers, one as Region and the other as State, whenever the North-East region is selected, only the relevant states (NY, PA, MA, and so on) are displayed in the State page header. This can be accomplished by using this type of representation. If the normal flat style is used, all the options are displayed irrespective of what is selected.
Generating the grid with banding
This is accomplished using DSSXMLBandingStyle in the result flags. This option generates the grid XML in a banding style. Refer to the following examples of a report with and without banding style.
Report without banding style:
Year |
Country |
Dollar Sales |
2019 |
USA |
$256,670.00 |
France |
$176,870.00 |
|
2020 |
USA |
$349,140.00 |
France |
$219,810.00 |
Report with banding style:
Year |
Country |
Dollar Sales |
2019 |
USA |
$256,670.00 |
2019 |
France |
$176,870.00 |
2020 |
USA |
$349,140.00 |
2020 |
France |
$219,810.00 |
In a banding style, a row header is repeated for all the rows even if it is the same row header.
The following XML is generated for a normal report.
<rh>
<rw o=1>
<h rs=”2” dpt=”1”>
<fy> 2019 </fy>
</h>
<h rs=”1” dpt=”2”>
<fy> USA </fy>
</h>
</rw>
<rw o=2>
<h rs=”1” dpt=”2”>
<fy> France </fy>
</h>
</rw>
</rh>
However, for the banding style, the following XML is generated. Note that the header that contains 2019 is being repeated in both rows.
<rh>
<rw o=1>
<h rs=”1” dpt=”1”>
<fy> 2019 </fy>
</h>
<h rs=”1” dpt=”2”>
<fy> USA </fy>
</h>
</rw>
<rw o=2>
<h rs=”1” dpt=”1”>
<fy> 2019 </fy>
</h>
<h rs=”1” dpt=”2”>
<fy> France </fy>
</h>
</rw>
</rh>
Running a report that contains a dimension in the template
For this kind of a report, the subtitle tag is included. Consider a report that contains the Geography dimension and a metric in a template. The following XML is generated. Note that a subtitle tag with the name of the attribute is included under the title for Geography. This also has a collection of subtitles representing the attribute forms.
<ly>
<rt cn="2" cm="1">
<t rfd="5" tp="4" spn="2" ui="1" dpt="1" hc="1" class="css0">
Geography
<stl rfd="3" spn="2" n="Country">
<stl rfd="6" spn="1" n="DESC"/>
<stl rfd="7" spn="1" n="ID"/>
</stl>
</t>
</rt>
<cts cn="1" cm="0">
<t tp="1" spn="1" ui="1" dpt="1" hc="1" class="css4">
Metrics
</t>
</cts>
<pts cn="0" cm="-1"/>
</ly>
Running a report that contains a custom group
Depending on the display type defined for the custom group, you can have some headers repeated with an extra attribute (mh). This is an optional attribute that indicates that the header is the same as its parent header. The GUI can choose not to display it. Consider the following report, which uses the custom group Seasons:
Year |
Season |
|
Dollar Sales |
2018 |
Spring |
|
$17954 |
|
April |
$6570 |
|
|
May |
$7530 |
|
|
June |
$3854 |
|
Summer |
|
$20456 |
|
|
July |
$4060 |
|
|
August |
$6702 |
|
|
September |
$9694 |
The following XML is generated:
<rh cn="11" pc="11" pi="1">
<rw o="1">
<h csp="1" dpt="1" ei="BB:8D679D5111D3E4981000E787EC6DE8A4:1:1:0:2:1998" o="0" rfd="3" rs="11" ui="1">
<fv class="css1" sm="2">2018</fv>
</h>
<h csp="1" dpt="2" ei="NE:3F185D7847D5D37C55F343B2C3D423D4:2" o="0" rfd="0" rs="1" ui="2">
<fv class="css1" sm="3">Spring</fv>
</h>
<h csp="1" dpt="3" ei="NE:3F185D7847D5D37C55F343B2C3D423D4:2" mh="1" o="0" rfd="0" rs="1" ui="2">
<fv class="css1" sm="3">Spring</fv>
</h>
<mv class="css9">$ 17,954.00</mv>
</rw>
As you can see, the Spring header is repeated twice, but the second one has the mh attribute set to 1. The same thing happens in the Summer header.
Note that for cases such as Outline mode, the XML does not change. The GUI is responsible for displaying the results in the desired format.