When I started working with MicroStrategy in 2013, the only method I could find to expand and collapse document sections was to use javascript/jquery. I learned all about this from Bryan Brandow and his blog BryanBrandow.com.





The Javascript method was cool, but had some unexpected consequences for both user experience and performance. Luckily, there is another way. I’m going to demonstrate how to expand and collapse sections in documents using the generic attribute (generic attribute post here ).





To begin we need a document which has two or more sections. For this sample I created a report which has a Category and Sales totals in one section and has an additional section with category, year, and sales.





Document with to sections









I want to have a selector which allows me to pick which groups I want to display. To do this, I will add a report to the documents which only contains my generic attribute. Then add the generic attribute to both grids.





The screenshot below shows some wacky results, but we’re going to fix that.





Added generic attribute









To control the wacky results, we will add an attribute element selector, select the “generic attribute”, and target the two grids. We must also set the selector to only allow for a single selection at a time.





Configured Selector









The grids look better, but now we must apply view filter logic to conditionally display the grids we want. We know that the first grid must always be displayed, so no view filter logic needs to be applied. The second grid should only be display when the Group2 option is selected.





To apply this logic, open the view filter settings and set the “generic attribute” in "Group2".





View Filter Config





We should also make sure that the section of the document is set to grow to fit the grid space. To do this right click the section of the document and select these options.

Grow section to height

You'll also have to make sure the project is set to hid empty grids within a document.

Hide Empty Grids

These are the end results:

The End Result

The last piece is to format the generic attribute. Just set the text width to 0 for this column and the user won’t notice the additional column. I like to take a few extra steps by setting the text font size to 2, removing cell borders for the generic attribute and set the background to “no fill”, but that isn’t required.





And there you have it! Custom expand and collapse functionality using only out of the box functionality. Have fun!

Thanks for checking out this blog post. If you found this post helpful please consider donating. Any contribution is appreciated! Just click the PayPal icon at the bottom of this page.



















