Embedding images, HTML, and links

There are many components that we can add to our dashboards to make them more attractive and useful. Images or backgrounds are one of them. Often customers ask to add a company logo to the documents or a link to the corporate portal. We can also embed HTML code (or JavaScript) inside a dashboard, a very good feature that we can leverage to accomplish things that couldn't be done otherwise. Security-concerned people may raise an eyebrow: it indeed poses a security issue, please check your company policies regarding this matter.

Getting ready

We are creating a brand new dashboard, so no special requirements.

How to do it...

Create a new document (Blank Dashboard template) and:

  1. Click on the green plus icon inside the gray area and from the drop-down menu select Image and wait a couple of seconds.
  2. The Properties and Formatting window appears with the Image Source textbox. Type a URL to an image, for example: http://images1.wikia.nocookie.net/__cb20130504095628/gtawiki/images/thumb/8/8a/Optional_Background.jpg/1024px-Optional_Background.jpg, and the preview will show it:
    How to do it...
  3. When you click on OK, the image appears in the document. Now that the image is selected click on it and drag it outside the gray area. Notice that the yellow border is highlighting the outer part of the document. Drop the image.
  4. While the image is still selected right-click on it and choose Order | Send to Back, so that the gray area is now visible over the image.
  5. Select the root panel and right-click on it, go to Properties and Formatting | Format | Color and Lines.
  6. Under Fill, open the Color control and click on No Fill; under Borders check All and specify Thick white color. Hit OK.
  7. Add a dataset and choose the number 28 in My Reports, then add a grid inside the root panel with the Product attribute and the metric.
  8. Run the document and see the result. The grid should be visible on the image background:
    How to do it...
  9. Save it as 32 Background and run the newly saved document.
  10. Go back to design mode. Now select the root panel and from the Insert menu click on HTML Container. Draw a little rectangle and release the mouse button. Inside the HTML container type this (the code should go on a single line):

    <button type="button" onclick="alert('hi hi hi hi hi!'),">Tickle</button>

  11. While the HTML container is still selected right-click and go to Properties and Formatting | Format | Color and Lines. Set Color to No Fill and Borders to None.
  12. Run in Interactive Mode and click on the Tickle button, do you see the message box? Click on OK and save the document overwriting the existing one. Click on Run newly saved document.
  13. Switch to Editable Mode. Right-click on the metric header and select Edit links….
  14. In the Links dialog box locate a textbox labeled Run this report or document. Click on the Select Target button with ellipses icon and navigate to My Personal Objects | My Reports to find the 31 Panels and Selectors dashboard (you may need to go to the second page to find it if there are many).
  15. Click on OK and then on OK again. Save, overwrite, and run again.
  16. Now the metric values are underlined, if you click on one of them, you will be redirected to the document 31. To go back, use the green Back arrow on the toolbar.

How it works...

The objects that we used in this recipe do not necessarily contain data but they do help you enrich the functionality and the appearance of your documents. You can use custom HTML and JavaScript, and with links you can enable the users to explore different documents and reports. It's easy to imagine that with these tools the possibilities are almost endless. With good HTML skills on your side you can rock and roll!

There's more...

I imagine some of you trying to insert CSS styles in the HTML container. There are some limitations: consider that you are writing inside the <BODY> of the page, but you cannot access the <HEAD> section. To do that, we would need to use the SDK and modify some system files, which is a little beyond the scope of this book. But yes, it is possible. Check the https://www.facebook.com/MicroStrategyHacks page to read some interesting tricks and insights about this technique.

Note

You can watch screencasts of this operation at:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset