Vous êtes sur la page 1sur 3

Defaulting Element Selectors Using URL API

BY BRYAN JULY 2, 2012

Ive previously written about using the URL API to answer prompts of
different types, but one feature that has been missing is the ability
to default selectors using this method. Being able to do so would
open up some really cool use cases, such as linking between
dashboards or linking from a subscribed email to a dashboard while
keeping the context for the user.
Well, I stumbled across a really good tech note that describes how
this feature was added to 9.2.1. I was able to get it to work (with
one unfortunate side effect Im still ironing out).
This method isnt exactly for the feint of heart. It feels more like a
hack than an actual supported feature, but well take what we can
get I guess.
Step 1 Get the Base Link
To start, get the base link to your document that contains the
selector you want to control. You can do this by right clicking on the
report in Web, choosing Get Link, and copying the URL from the text
box.
Step 2 Get the ID of the Target Selector
This part might be a little tricky. The Selector ID is going to be 3
characters, starting with a letter, and ending with 2 numbers, ie,
W64. To get it, you have to run your document in Interactive mode
and View Source in your web browser. Itll be a little difficult to find,
youre looking for <select id=W64 though your ID will surely be
different. The best way to find it is to use the Firebug plugin for
Firefox, or Chromes Inspect Element utility. Right click on the

selector in question, inspect it, and it should highlight the relevant


code in the HTML.
There are two pieces of information you need to extract in this
manor:
- Selector ID as mentioned above, itll be in the format W64, or
equivelant.
- Element ID itll start with the letter h, followed by your element
and then the Attribute GUID,
ie, h2;8D679D3711D3E4981000E787EC6DE8A4 would pass the
value 2.
Step 3 Craft the URL
The URL youll need to craft will take on this format:
BaseURL from Step 1
&evt=2048084
&src=Main.aspx.rwd.rwframe.rwb.2048084 (if youre using JSP,
substitute Main.aspx for mstrWeb)
&ctlKey=SelectorID from Step 2
&elemList=ElementID from Step 2
&usePartDisplay=1
&currentIncludeState=true
&applyNow=1
&evtorder=2048001%2c2048084
&2048084=1
&2048001=1
An interesting thing going on here is that were actually passing two
events (evt) to the page. Ive personally never encountered this
before, but MicroStrategy handles it by declaring the &evtorder to
determine which order to process the events. I couldnt find any

documentation on event 2048084 as its mysteriously missing from


the events.xml file on Web. I assume its related to selectors
because of the context were working in. In any case, you dont
have to modify any of the non-Red fields in your link.
Issues
This worked really well for me except for one issue I havent
resolved yet. The document I was linking to was running in express
mode (&currentViewMedia=1), but despite specifying that view
mode, adding the new tags to default the selector switched the view
to Interactive mode. I couldnt find a way to overcome this and
currently have a case open with Technical Support. Ill come back
and update once thats resolved.
The source for this article is this tech note on the MicroStrategy
Knowledge Base. For more information and some nice screenshots,
check it out.

Vous aimerez peut-être aussi