The Spotfire Community is moving to TIBCOmmunity and this forum location has closed. During the transition, you can still search the old forums but posting has been disabled. We encourage you to pick up the discussion at the new Spotfire community on TIBCOmmunity.
November 2010 - Posts - Tip of the Week

Tip of the Week

November 2010 - Posts

  • Sharing, Collaborating, and Annotating your Spotfire Analysis – Part III

    In the last two weeks we have built various components which enable us to use Spotfire as a social annotation and collaboration tool.

    In this week’s post we will show you the same functionality, but implemented in another way.  

    Storing State

    Rather than passing the state information (Marking, Filtering, Active Page, and Comments) around as query parameters in a URL, we are going to store the state information in a database.This has a couple added benefits. First, you are not limited to the size restrictions of a URL. Second, you are not making the state information visible from the URL and the data can be secured better in a database. Third, you are capturing these states and annotations in case you want to use them later, like in an audit trail or similar.

    The image below shows the column information for a database table in Microsoft SQL Server.  


     

    In this example, we use two database columns to store the marking information. The first (markingColumn) will store the marking column to be used from the analysis and the second (markingValues) will store marking values.

    Similarly, the filtering information will also be stored using two database columns: filteringColumn and filteringValues.

    In addition we store the Active Page of the analysis and comments the user entered.  Finally a GUID is generated in our code and passed in as a primary key.

    An example SQL statement is shown below:

    INSERT INTO dbo.States (GUID, markingColumn, markingValues, filteringColumn, filteringValues, activePage, comments)
    VALUES ('4d36e97d-e325-111e-bf21-08002be65123', 'Symbol', 'SINVX,SASSX', 'Category', 'Large Growth, Large  Value, Small Growth', 'Short-Term vs. Long-Term', 'Take a look at these stocks')

    After inserting this record into the database, the GUID is returned and then appended to our custom URL which can be shared out.

     


    Retrieving State
    To retrieve the state, users will enter the URL from above in the Web Browser, and the code will retrieve the GUID from the query parameter just like we did in the earlier posts.

    The GUID will then be used in a SELECT statement on the Database to retrieve the state information.

    SELECT * from dbo.States where GUID = '4D36E97D-E325-11CE-BFC1-08002BE76212'

    Once we loop through the resulting column values from the database, we will use the Web Player APIs from last week’s post to set the state on the Analysis File as well as display the comments.

    Keeping Track of Annotations
    Using the same code, it is also very easy to update your web page to show a list of all the annotations for the given analysis file, rather than just one specific one. In this use case, it can serve as an audit log, or process flow showing how the analysis results have been collaborated on.

     

     

    If you are interested in creating similar functionality, please consider taking our Web Player API course, or hiring Spotfire Professional Services to help you.

  • 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








  • Sharing, Collaborating, and Annotating your Spotfire Analysis – Part I

    This week we will start a three part series that leads us through the process for using Spotfire as a Social Annotation and collaboration tool to aide in your analysis process.  We are all aware of the analytic powers and capabilities of Spotfire, and many people are also aware that it can be deployed to a web page , either as an entire file, or as components in another site, like a portal or a mashup.  However, very few people are aware of the capabilities that exist to use it in a collaborative fashion with colleagues.

    This post will focus on how to pass information into a Spotfire Analysis file which will set its state (active page, filtering and marking). The next post will focus on how we can capture state from a Spotfire Analysis file, and the final post will put everything together to build a social annotation and collaboration tool powered by Spotfire.

    Spotfire has an API (called the Web Player APIs) that allows you to launch Spotfire Analysis files inside the Spotfire Web Player. These APIs also have an option that allows you to configure the initial state of the analysis, using a configuration block.

    The configuration block can include property values, as well as a way to set the active page, apply a bookmark, set filtering on the analysis, and set marking on the analysis file.   This configuration happens before the file is displayed in the browser, so it can be used to show different states of the same analysis file as they are loaded.

    To further this use case, we can create a web page which will allow users to pass in query parameters related to the state of the Web Player.  The web page can then parse these parameters, turn it into a configuration block, and load the appropriate state for the appropriate analysis file.

    Take a look at one such example listed below: 

    http://spotfire.tibco.com/community/Downloads/spotfireLive.html?fcs=Category&fcv=Large%20Growth,Large%20Value&ap=Short-Term%20vs.%20Long-Term&wmc=Symbol&wmv=SINVX&comments=Check%20this%20stock%20out

     

    This will launch an analysis file analyzing mutual funds from the library (the analysis file is hardcoded , but could also be exposed as a parameter). The active page is set to the Short-term vs. Long-Term page. The analysis is then filtered to show only funds where the value in the 'category' column is either 'Large Growth' or 'Large Value' funds. Finally, rows where the value for the 'Symbol' column is SINVX are marked. We can also, quite easily, pass in comments via the URL string and then display them either in a Property Control inside the Spotfire file or inside the original web page in our mashup.

    This example is limited and tightly coupled with the mutual fund analysis file that was loaded, but with more time, this can be turned into a production application which takes into account many different scenarios and combinations.

    Passing in the values via the query parameter may work as is for some situations, but it requires the users to be savy enough to build the URL string. Having a way that we can capture the desired state from a web player user programmatically and then use that to generate a custom URL for us would be ideal. This is what we will explain and show in our next post. Then, finally, we will put it all together and store the state information in a database  so that we do not have to pass it back and forth inside the URL query parameters.

    If you are interested in doing this, you can either purchase our Web Player API training course, or you can contact our Professional Services team to scope out and build this specific for you.

  • Using Toggles without Script Controls

    There have been quite a few tips already about the power of using both Property Controls and Script Controls.  However, there are a lot of authors who either do not have access to Script Controls or who do not want to use them.  There are still some very important tasks you can accomplish with just Property Controls. One such task is a toggle which updates whether or not certain ‘axis are on or off’.


    For example, you may want to have a user decide whether or not to use the color by axis on a plot, or the shape, size, or trellis axis.

    To do this, we first create a Drop-down list Property Control. This should be attached to a string property. The property value option should be set to ‘Fixed values’, and there should be 2 values: one with a display name of ‘Yes’ and the value set to <Region> (or the name of your column you wish to use here inside the brackets), and the other with a display name of ‘No’ and the value set to <>.
     

    Note that if you want to have coloring be continuous, just remove the brackets (<>) from the values.

    Once we have our Drop-down list setup, we then need to attach the property to the desired axis. In our example, let’s say we want to use the property control to toggle on and off the color by axis. When its set to ‘No’ there is no column expression used in the Color by axis, and when its set to ‘Yes’ there is a pre-defined column or expression which will be used.

    To use this property in the Color by axis, right click on the Color axis selector and select ‘Custom Expression…’


     

     

    In the expression we want to insert the colorToggle property we just created.
     

     

    If you wish to extend this so that you give the users a choice of what column to use, in addition to the choice to  use no columns, you can do that as well.

     

  • Organizing Your Lists

    For customers who make heavy use of the Lists feature, it can quickly get cumbersome to find lists of interest, since they are perpetual on an individual user’s computer.  If you are looking for a way to organize your lists, you can use lists which mimic creating a folder directory.

    To start with you can create an empty list by choosing ‘New list from marked’ when there is no data currently marked.


     
     

     

    You can then drag and drop other lists into the empty list creating a customized hierarchy of lists.

     




    Remember to  make sure you use  good list names and tooltip Annotations (available under List Properties). For example, in the final screen shots below, we show how to add annotations to one of the list containers, and we also show the 'Empty list' list updated to be something more recognizable and useful ('Daily Results Lists')


     

     

     


     

Syndication

Other Spotfire Blogs

©Copyright 2000-2011 TIBCO Software Inc | Privacy Policy | Terms of Use I Blog I Contact Us I Content Center