Tip of the Week

Saving Comments from within the Web Player

In earlier posts, we discussed how you can share annotations with other users of an analysis file.  Most of these solutions required building a mashup using the Spotfire Web Player APIs, and quite a few people asked if there was a way to implement similar functionality without using the Web Player APIs. While there is not a solution that provides all the same functionality as the previous tips, there is a way you can accomplish the saving of comments without using the Web Player APIs. 

First, you need to create something that will store the comments.  The best scenario is to use something that will automatically persist the information for you so you do not have to worry about implementing this. You can do this by using a Document Property. You can expose this property via a multi-line input field Property Control.

Next, using a Script Control, you can create a button which will use the Spotfire Automation APIs to save the file back to its original location in the Spotfire Library. By doing this, it will include the latest value of the property, including any updates made by the user in the Web Player.

The script is actually only one line of code:

Application.Save()

With this solution, it will also save the current state of the analysis file, including the active page, as well as active marking and filtering. This could be the desired effect, or you may want to update your script to reset the file to load the first analysis page the next time the file is opened. If you wish to save the file with the first page in the analysis loading, then add the following line of code in your script before the Application.Save() command:

Document.ActivePageReference = Document.Pages[0]

You can also extend this script to add some more complex functionality like setting the analysis so that no markings or filtering are used. 

When you are done with the Script Control,  users can enter comments in the input field and then they can click the ‘Save File’ button to trigger the script. The next time the file is opened, it will contain the latest contents, including the comments in the property control.

 


 
A variation of this solution would be to have the script take the contents of the property control and append them to a text area in the analysis file, as shown below.

 

One issue with these approaches is that you will not be able to use it if you have anonymous access setup for the Web Player. Using the APIs to save the file will cause an authentication error.  If this is the case, you will need to alter your solution a bit.  Rather than storing the comments in a property, you will need to store the comments in another location, like a text file accessible via URL.  Then, you need to update your script to read the text from the file and then display them in a text area. This way, the analysis file is never altered or re-saved, but the script is just reading in text from an outside source which is saved somewhere. 

Its also important to note that this solution works when saving the original file as itself, but its not possible to use any of the Save As capabilities to store different versions of this analysis file. Trying to use those Automation APIs will cause an error when executed from within the Web Player.

Comments

 

Aman said:

Hi Kevin, Looks like the analysis cannot be saved if the name already exists. Can you also leave the code for overwriting it?

January 9, 2011 9:06 PM
 

Peter Gruener said:

Kevin,

What is going to happen if a user with read only access to the library will try to save a comment?

Peter

March 3, 2011 2:41 AM
 

Kevin Hanegan said:

Hi Peter,

Good question. There will be an error message if the user does not have write access to that file in the library.

Kevin

March 13, 2011 3:18 PM
 

Kevin Hanegan said:

Hi Aman,

What error are you getting? Do you have anonymous access setup? The saving should work as is, if you are not using anonymous access.

Thanks,

Kevin

March 13, 2011 3:19 PM
 

<a href="http://www.guccibagshoppes.com/">{gucci handbags on sale}</a> said:

{offers a|supplies a|gives the|provides a} <a href="www.guccibagshoppes.com/">{gucci handbags on sale}</a> selection of the {finest quality|most useful|highest quality|most suitable|finest|best quality} Gucci Replica available {right now|nowadays|these days|today|currently|now}. Genuine watches of these replicas {have become|are very|became|are|are extremely|have grown} expensive and the {range of|collection of|choice of|number of} the rich, famous and collectors {world wide|around the world|all over the world|worldwide|everywhere|around the globe}. These watches were {made from|beautifully made with|designed with|fashioned with} the greatest detail {in addition to|along with|and|and also|plus|as well as} craftsmanship. Each watch {continues to be|has been|may be|have been|has become|is} masterly manufactured to replicate {the original|the|the initial|the main|an original|the first} designer piece. The original pieces {tend to be|are generally|are usually|are|will be|usually are} originally designed by {modern|today's|present day|current|the modern|the current} elite craftsmen and {results in|ends up with|ends in|leads to|brings about|ends up in} exhorbant prices as {they are|they're just|there're|they're|they may be|these are} marketed under infamous {makes|brand names|brandnames|brands|companies|manufacturers}. By purchasing a <a href="www.guccibagsshoppes.com/">{gucci outlet}</a>

April 25, 2011 9:34 PM
 

used car for sale said:

There are several characteristics that make West Covina a great place to buy a used car.  One of the biggest reasons that you can find so many great deals on used cars is because a larger than normal percentage of the population tends to buy new cars.  This means that there are more used cars on the market than in most other areas of the country.  Additionally, there are less people interested in buying these cars, which results in lower average prices.

=================

August 3, 2011 3:39 AM
 

used car for sale said:

used car is a good car site.

=================

<a href="http://used.gov-auctions.org" rel="dofollow">used car for sale</a>

August 3, 2011 3:41 AM
 

used car for sale said:

Used cars model is like many people. so its engine, colour, price is very good.

================

<a href="http://used.gov-auctions.org" rel="dofollow">used car for sale</a>

August 3, 2011 3:45 AM
 

uggkensington said:

http://www.uggkensingtons.org/

http://www.uggkensingtons.org/ugg-fox-fur-short-boots-5531-c-54.html | UGG Fox Fur Short Boots 5531

http://www.uggkensingtons.org/ugg-kensington-boots-5678-c-2.html | UGG Kensington Boots 5678

http://www.uggkensingtons.org/ugg-rainier-eskimo-boots-5189-c-85.html | UGG Rainier Eskimo Boots 5189

http://www.uggkensingtons.org/ugg-retro-cargo-boots-1895-c-3.html | UGG Retro Cargo Boots 1895

December 27, 2011 7:59 PM
 

uggskensingtonsale said:

www.uggskensingtonsale.org

www.uggskensingtonsale.orgugg-adirondack-boots-ii-c-6.html | UGG Adirondack Boots II

www.uggskensingtonsale.orgugg-adirondack-tall-boots-c-11.html | UGG Adirondack Tall Boots

www.uggskensingtonsale.orgugg-amberlee-boots-c-34.html | UGG Amberlee Boots

www.uggskensingtonsale.orgugg-annabelle-boots-c-35.html |

December 28, 2011 3:45 AM
 

uggretrocargosale said:

January 4, 2012 8:46 PM
 

Generic Viagra said:

Excellent article. You have made your point and there is not much to argue about. It is like the following universal truth that you can not argue with: No truth is universal, everything has its exception. Thanks for the info.

www.onlinemedicalstore.net/caverta-19-184.html

www.onlinemedicalstore.net/kamagra-19-188.html

February 28, 2012 4:31 AM
 

Caverta said:

Great information you got here. I've been reading about this topic for one week now for my papers in school and thank God I found it here in your blog. I had a great time reading this.

February 28, 2012 4:33 AM

Leave a Comment

(required) 
(optional)
(required) 
Submit

Syndication

Tags

Other Spotfire Blogs

Spotfire's interactive information visualization and analytic solutions give users a remarkable experience for quickly and easily querying data and reporting results for superior business intelligence. From portfolio management and customer retention programs to key processes such as CRM, marketing, research, bioinformatics, yield and asset management and design for manufacturing, enterprises around the world rely on Spotfire's business analytics software to improve operational performance.

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