Background Story and Motivation:
Imagine having two dashboards, both of them monitors the same set of pumps. First monitors the electricity consumption and fluid flow over time. The other dashboard monitors the pressure and performance in general.
Imagine something like:
Problem and use case
Our use case was user starts with dashboard A to check one of the pumps say P1, and then they need to check another variable for the same pump in dashboard B, so we need to show P1 only in dashboard B and nothing else!!
Configuration Blocks in Spotfire
Configuration Blocks in Spotfire is a way to pass or adjust some features in a non-opened dashboard (.dxb file) at the time of opening. Imagine you have a dashboard with 100 curves and you want to open this dashboard for one specific curve, this is one of many applications. In general, configuration blocks can control/adjust the following aspects of a .dxb file:
- SetPage: Specifies the initial page of an analysis
- ApplyBookmark: Applies a bookmark
- SetFilter: Specifies the initial setting of a filter of an arbitrary type
- SetMarking: Initializing a marking
- Setting a document property
Checkout the one of the many use cases when you utilize the Document Property along with Python Script to trigger a different Python Script for each Scenario.
Where to use Configuration Blocks:
There are 5 places where you can use the configuration blocks:
- As C# extension
- In Web pages using JS API
- In Spotfire Analyst Client using command line
- In Automation Services using the 'Open Analysis' Task
- In Web URL when accessing the dashboard from the web (Web Player)
We will focus on the last task in Article, injecting variables in the URL when opening a dashboard through the web browser.
Web URL structure:
URL Encoding
In order for the configuration block feature to work properly, you need to URL encode everything after the (=) in the structure above. To do so there are many websites, I used this website in my example. It?s recommended that you write all your configuration statements, encode them and paste them after the (=) sign. Here is an example on how to encode a setPage configurator to make the dashboard go to "HOME" page
once it's opened.
Step1: URL encode your statement
Step2: Assemble your URL (Do not forget the semicolon at the end of each configuration statement)
Assembeled URL is: http://yourSpotfireServer.com/pathToYourFileAndFileName&configurationBlock=setPage(PageTitle%3D%22HOME%22);
the URL below is an example of passing the Page Title, Table name and filtering.
https://spotfire-next.cloud.tibco.com/spotfire/wp/analysis?file=/Samples/Introduction%20to%20Spotfire&configurationBlock=SetPage(pageTitle=%22Filtering%22);SetFilter(tableName=%22World%20Bank%20Data%22,columnName=%22Region%22,values=%7B%22North%20America%22,%22Europe%20%26%20Central%20Asia%22%7D);
Recommended Comments
There are no comments to display.