test

Warning when upgrading to Spotfire 10

TIBCO has deprecated the JQueryUI Javascript library in the latest Spotfire 10.0 release

TIBCO Community pages show us how to use JQuery properly

Force user to run a script at start-up

Method 1:
  1. Register a Data Function
    Edit > Data Function Properties > [Register New]
       Name: copyCutomExpressionToDocPropViaDataFunction   
       Type:
    TERRR 
       Script:
     y<-x   
       Input Parameters > [Add]
          Input parameter name: x     
          type:
    Value     
          allowed data types: 
    [all]
       Output Parameters > [Add]
          Result parameter name: y      type: Value
  2.    [Run] to Edit Parameters
          Name: currentTime
          Refresh function automatically:[x]yes  [ ]no
          Run Location: Force Local     
            input > x > input handler > Expression

             Expression: DateTimeNow()      
             Output > y > Output Handler > Document Property > [New]: yourDocProp
  3. Attach your Action Script when yourDocProp changes.

Method 2:

Basically you change the page navigation to history arrows showing an 'agreement or welcome' page with an OK button that triggers your start-up script. Last line switches  back to tabs or step by step page navigation mode.

# change manually the page navigation mode to 'history arrows' to force user to click on the agree button 

# --------------------------------------------------------
# your start up script goes here

# Example of a startup script:
# Requirement is to set row level security with embedded data, so 
# personalized info links are not an option. 
# We could get username from the system and store it on a document property
# and use the document property to limit the data by user
from System import Environment
Document.Properties['currentUser'] = Environment.UserName



# To limit the data by user on your visualization, we use a custom exprssion like this: '${currentUser}' = [user]
# The previous step could be scripted, but it is out of the scope of this post, so data limiting on a visualization by user is done manually for now

# Last step will be to move to the page of your choice and switch back to tabs
# --------------------------------------------------------

# Change to tabbed pages
Document.Pages.NavigationMode = Document.Pages.NavigationMode.Tabs

7 comments:

Anna_Saratovtseva said...

Do you have any example of how to do data limiting on a visualization inside Python script instead of manually? I'd really appreciate that!

Jose Leviaguirre said...

Hello Anna, There are couple of ways,
1) Set the filters programatically: http://spotfired.blogspot.com/2014/03/change-filters-programatically.html --or-- http://spotfired.blogspot.com/search?q=filter
2) Manipulate the underlying data programatically
3) Create a custom expression in your visualization>properties>limit data using custom expression. There, you can also use property control valuesl.

If you send me your specific requirements, I can probably help you.

Anna_Saratovtseva said...

Jose, thank you for the solutions you mentioned. I am mostly interested in number 2 - how to manipulate the underlying data programatically. If you could share some example, that would be great! I'm just thinking what solution to choose and I need to learn of all possible ways to do it.

Anna_Saratovtseva said...

I guess I've found what I was looking for - WhereClauseExpression:

from Spotfire.Dxp.Application.Visuals import VisualContent
vc = vis.As[VisualContent]()
vc.Data.WhereClauseExpression = "[ColumnXXX] = 2"

Source: http://stn.spotfire.com/spotfire_client_help/text/text_action_script_examples.htm

Jose Leviaguirre said...

Thanks for sharing Anna!

Anonymous said...

Hi Jose,

do you know a way how the switch to another tab AND execute a script when the user clicks on an action control? I'm afraid only one of them is possible at a time?

Cheers
Christian

Jolene said...

To execute a script at startup and when toggling tabs, I used a hidden button and $(document).ready(function());, but toggling tabs doesn't seem to work anymore in the 6.5 client. It works in the web player though.

$(function () {
function executeScript() {
$('#hiddenBtn input').click();
//or- document.getElementById('hiddenBtn').childNodes[0].click();
}
$(document).ready(function(){executeScript()});
});