Using Object Prompts with Documents
Object Prompts are incredibly useful objects that allow you to build some very dynamic experiences in MicroStrategy. You can customize a report experience with them and alter the layout based on user input. Unfortunately, it’s not very straightforward to use Object Prompts with Documents. This is largely due to the Object Prompt being a property of the Grid Report that doesn’t get carried over into a Document. However, there are still some tricks we can do to get the functionality to behave properly in a Document, it just takes a little bit of work.
First, I’ve created an Object Prompt that contains the Region, Cost, Profit and Unit Sold metrics. The goal is to create a document that will show a trend graph for the single metric that the user chooses from this prompt. Simple enough, but if we try to create a Document based on this report, it looks like this:
Here’s the trick. Add the metrics AND the Object Prompt back to the Report’s template, like we originally had it.
Save & Close the Document, and now return to the View Report, and move the Metrics back into the Report Objects.
Save & Close, and when you return to your Document, something magical has happened…
The metrics are no longer available in the Report Objects, but the Document still retains a reference to the original metrics that were originally there. So what? Well, what happens now when we run the report …
So, why does this work? The reason has to do with some error handling that is built into the Document. The Document’s grid template is expecting all 4 metrics. When we answer the Object Prompt with Revenue, we saw that it adds it to the Data Set Objects in the Document. This means that the Document grid template’s definition of Revenue is valid, but it’s definition of the other 3 metrics are invalid. MicroStrategy ignores the references to the other 3 metrics since they don’t exist and we’re left with the only the metric we chose in the prompt!