MicroStrategy – HTML Tags with Attributes

Link to polish version: https://birabbit.com/microstrategy-html-tagi-z-wykorzystaniem-atrybutow/

————————————————————————————————————————-

This article addresses the use of HTML tags on the MicroStrategy attribute forms. By using such solutions, developers and architects can enrich their projects with additional and unconventional functionalities.

1.Tooltips

By utilizing HTML tags, we can add a description (Tooltip) to attributes, which will be displayed when hovering over any attribute element in the visualization. This functionality can be useful in situations where a particular attribute requires additional explanation.

A) Static Tooltip – the same for all Attribute Elements.

Steps to execute:

  • • Launch MicroStrategy Developer.
  • • Select the attribute for which you would like to add a Tooltip.
  • • Decide for which Attribute Form of the selected attribute you want to display the Tooltip. (In the example above, the DESC of the Country attribute was selected, which in this case corresponds to the name of the given country)..
  • • Proceed to modify the selected Attribute Form.
  • ApplySimple("'<span title=""Insert comment here"">'+#0+'</span>'"; [COUNTRY_NAME])
  • • Modify the expression according to your needs.
  • • Choose a specific column from the table that you want to display as the Attribute Form for the attribute you're modifying (this is where the Tooltip will be displayed – in the example, it's [COUNTRY_NAME]).
  • • Set the Form format type to HTML Tag.
  • • Save the attribute.
  • • Update the schema.
    The attribute with the Tooltip is now ready to use.

B) Dynamic Tooltip, the description differs for attribute elements.

Steps to Execute:

  • • Follow the first four steps the same way as for the static tooltip (point A).
  • • The form expression template for creating a dynamic Tooltip looks as follows:
  • ApplySimple("'<span title=' +  CASE    WHEN #0 = ""attribute element 1 name"" THEN ""Tooltip&nbsp;example&nbsp;text&nbsp;for&nbsp;element&nbsp;one""    WHEN #0 = ""attribute element 2 name"" THEN ""Tooltip&nbsp;for&nbsp;element&nbsp;two""    ELSE ""Tooltip&nbsp;for&nbsp;remaining&nbsp;attribute&nbsp;elements""  END +'>'; + #0 + '</span>'"; [column_name])
  • • The Form expression shown above was used in the previously presented example of a dynamic Tooltip, which targeted two attribute elements: "Electrical bike" and "Non-electrical bike."
  • • Modify the expression according to your needs. Change the comment, select the specific column from the table that you want to display as the Attribute Form for the attribute you are modifying (this is where the Tooltip will be displayed).
  • • Adjust the number of Attribute elements; add tooltips to more attribute elements in the same way the first two were added.
  • • Note that the spaces in the tooltip description are represented as "&nbsp;".
  • • Set the Form format type to HTML Tag.
  • • Save the attribute.
  • • Update the Schema.
    The attribute with the Tooltip is now ready to use..

2.Attribute as a Dynamic Link to a Website.

By using HTML tags, we can make attribute elements displayed in a visualization function as links to specific web pages. This functionality can be particularly useful when we want to direct users to a specific website that contains additional information related to a given attribute (e.g., a company).

In the example above after clicking on the selected category, the user is redirected to the corresponding Wikipedia page for that category.

Steps to Execute:

  • • Launch MicroStrategy Developer.
  • • Select the attribute from which elements you'd like to create a hyperlink to a website.
  • • Choose the Attribute Form of the attribute for which you want to create the hyperlink. (In the example above, the DESC of the Category attribute was selected, which in this case corresponds to the name of the category).
  • • The form expression for creating a dynamic hyperlink to an example website looks as follows:: ApplySimple("'<A HREF=https://en.wikipedia.org/wiki/' + #0 + '>' + #0 + '</A>'"; [CATEGORY_DESC])
  • • Remember that the above solution is dynamic, so in the example above, after selecting a category like "Books," the user will be redirected to the page https://en.wikipedia.org/wiki/Books and not to https://en.wikipedia.org/wiki/.
  • • Set the Form format type to HTML Tag.
  • • Save the attribute.
  • • Update the Schema.
    The attribute with the dynamic hyperlink functionality is ready to use.

3. Passing the  answer to the prompted report/dashboard from an attribute element 

Another use case for an HTML tag with attributes is a scenario where the value of an attribute element is passed as a response to a prompt in another report/dashboard.

In the example above, the USA was clicked, and it was passed as a response to the prompt in the target report (which is a separate MicroStrategy object where the above visualization was not created).

After clicking on "USA," the user is redirected to a new browser tab that opens the target report containing additional information exclusively for the selected country.

Steps to execute:

  • • Launch MicroStrategy Developer.
  • • Select the attribute from which elements you want to choose the response for the prompt..
  • • Choose the Attribute Form you want to use in the prompt. (In the example above, the DESC of the Country attribute was selected, which in this case corresponds to the name of the country).
  • • Create a target report containing the attribute that will be used in the prompt and additional details (in the example above, Country is the attribute used in the prompt, while the additional details are Distribution Center and Employee Headcount).
  • • In the Report Filter section of the target report, create a Value Prompt using attribute qualification (in the example Country DESC).
  • • Save the Target report.
  • • Go to the editing of the selected attribute (in the example, Country).
  • • Proceed to modify the selected Attribute Form (in the example, Country DESC corresponds to the [COUNTRY_NAME] column).
  • • In this example, to build the correct expression form for the created target report, you need to log in to MicroStrategy Web, locate where the target report was saved, then right-click on it and go to Properties.
  • • Copy the Link.
  • • Modify the copied Link so that it starts with mstrWeb?Server= (remove any parts of the link that appear before mstrWeb).
  • • Paste the modified link into the following expression form: ApplySimple(" '<a target=_blank href=replace_here
  • • At the end of the created expression form add: &valuePromptAnswers='+#0+'>'+#0+'</a>'";[COUNTRY_NAME])
  • • Replace [COUNTRY_NAME] in the above expression form with the column you have selected for the modified Attribute Form.
  • • Set the Form format type to HTML Tag.
  • • Save the attribute.
  • • Update schema.
  • • Create a new report that will contain the modified attribute (make sure that the previously modified Attribute Form is displayed in the visualization).
  • • After clicking on any Attribute element displayed in the visualization, the user will be redirected to the target report, which is dynamically prompted by the selected element.

Dodaj komentarz