Sharing, Collaborating, and Annotating your Spotfire Analysis – Part II


Last week we looked at how we can use the Spotfire Web Player APIs, along with a standard web page, to open a Spotfire analysis file to a specific state. This was done using a configuration block.

In this, the second part of a three part series, we will look at the Web Player APIs which allow us to retrieve the state from an already opened analysis file.  This can be used for a variety of tasks ranging from mashups with other applications, audit logs, sharing and collaboration tools, etc... Specifically in this example, we will use it to generate a URL similar to what we used last week as input to our mashup.  

This example will perform three actions with the Web Player APIs: retrieve the current marking, retrieve the current filtering, and retrieve the active page.

Marking
To retrieve the current marking that is applied to our analysis file, we call the getMarking function. This takes in a variety of parameters, like the Marking Name, the Data Table, a column you want to retrieve as the key for marking values, and the output will be a comma-separated list of values.
   

    function getMarking(markingName, dataTableName, dataColumnNames, maxRows, callback);


Filtering
To retrieve the current filtering that is applied, we call the getFilterColumn function. This takes in a variety of parameters, like the Filtering Scheme name, the Data Table,  and a column you want to retrieve the filtering values for.

     function getFilterColumn(filteringSchemeName, dataTableName, dataColumnName, includedFilterSettings, callback);
Active Page
To retrieve the active page, we call the getActivePage function. This will return both the index and the title of the active page.  To access the title, we can use the following code:

     function getActivePage(callback);

In this tip, we are hard coding many of the high level values, like filtering scheme, marking, data table, and columns to retrieve information on, but in a more production-ready solution, this could all be automated as well. This is just an attempt to show you the capabilities of what you can do.

Once you have all this information, you can group the functions all together under a single HTML button called something like ‘Capture State’. This button would retrieve the marking, filtering, and page, and create a URL with this information as Query Parameters (similar to what we used last week as input). In addition, we could also add a HTML text area in our mashup where the user could enter their comments.

 

 
In the finished version, the user can move to a specific page in the analysis, mark some records, filter some values, and then add a comment in the comment field, and click the ‘Capture State’ button. This will return them a URL which they can use in conjunction with last week’s tip to share their state and comments with others.


 

In the final version we will show next week, we will not use Query Parameters as a way to pass state information back and forth, rather we will store all state information in a Database.

Want to check out this solution? Please visit it at: http://spotfire.tibco.com/community/Downloads/spotfireLive2.html