Analysis Specific Help for Files viewed in the Web Player


In an earlier post, we discussed how to add instructions into an Analysis File which was meant to be viewed via the Spotfire Professional or Enterprise Player clients.  In this post, we will learn how to do the same thing , but for use in files viewed via the Web Player.


By using Spotfire's SDK, you can add custom help files to the platform. However, these help files are available all the time, no matter which Analysis File you are using. There is a need for a analysis specific help system to aide your consumers as they use the file.  This can be achieved by adding a Help button inside a Text Area, which will launch a HTML file displaying instructions and help for users.  This also serves as an added benefit of reducing the amount of text required inside a file itself, so that more real estate can be used for visualizations.

To start, as the author of the file, you will need to use Spotfire Professional, and with your Analysis File open, add a Text Area.  Then go into edit mode (either by right clicking and selecting 'Edit Text Area' or by clicking on the pen in the top right of the Text Area).  You will then choose to add a Script Control.

In the Script Control, you will add the following code:

from Spotfire.Dxp.Application.Visuals import HtmlTextArea
from Spotfire.Dxp.Application.Visuals import VisualTypeIdentifiers
from System.Text import StringBuilder

from Spotfire.Dxp.Application.Visuals import HtmlTextArea
from Spotfire.Dxp.Application.Visuals import VisualTypeIdentifiers
from System.Text import StringBuilder

sb = StringBuilder()

sb.AppendLine("<script type='text/javascript'>")
sb.AppendLine("function openWin() {")
sb.AppendLine("window.open('http://spotfire.tibco.com/community','mywindow','width=400,height=200')")
sb.AppendLine("}")
sb.AppendLine("</script>")
sb.AppendLine("<BODY>")
sb.AppendLine("<INPUT type='button' value='Launch Help'onClick='openWin()'> ")

textArea = Document.ActivePageReference.Visuals.AddNew[HtmlTextArea]()
textArea.AutoConfigure()
textArea.HtmlContent = sb.ToString()

 

 
Once you have created the script you can click 'OK' to close the Edit Script Dialog. You can then execute your script, and it will create a new Text Area with a button in it called 'Launch Help'.

 


You can later remove the original Text Area you used to create the Script.  When this file is opened in the Web Player, the 'Launch Help' button will open up a new window with your desired contents (you will want to replace the URL in the script above with the URL to your help instructions).

In this example, we just reference a web site using a URL, but we could reference a .chm help file or  include the instructions built into the document as properties and dynamically build the contents for the dialog as we did in the earlier post.