Using TIBCO Spotfire version 3.1 for Scenario Analysis



I'd like to be one of the first to start introducing you to the amazing new features of TIBCO Spotfire Professional 3.1.  This will kick off an arc of tips related to 3.1 features. This tip will introduce you to the updated Property capabilities.

If you remember our previous tip discussing Column from Marked, you will remember that one use of it was a workaround to allow users of the Web Player to update axis in visualizations.  You may also remember an earlier tip on using Global Variables inside TIBCO Spotfire , where we discussed creating a document property that held the exchange rate, which could then be used in various visualizations in place of hard coded values.

 
What if you wanted to allow consumers who use the web player or any client to update the property themselves? This would allow consumers to update the expressions included in many visualizations, creating a kind of scenario analysis.

Let's assume we have a Bar Chart that shows the initial amount of an investment for three separate investments (100, 200, and 300).

 

We can then create a new property, just as we could have before version 3.1. If we want to create a Document Property , we can do that from the Edit > Document Properties.  In this case, we will create a property called rInterestRate. It will be a Real and the starting value will be 0.05. There are new ways to create these properties as well in the UI for 3.1, but we will not be discussing those in this tip.

 

Now that we have the property created, we need to include the properties into our logic for our analysis file.  Let's assume we want to create a second Bar Chart, and this one will show amount of the three investments after 10 years using a user specified interest rate.  This user specified interest rate is going to be stored in the property we just created.

In this example, we will right-click on the Y-Axis of the second Bar Chart and select Custom Expression'

In the resulting Custom Expression dialog, there is new support to enter a property into the expression. There was a method for doing this before 3.1, which is still supported, but there is a new and improved Custom Expression dialog which shows all the available properties as a pane. This will allow you to highlight the property and click the Insert Property button to add the property into your expression.

 

The specific expression we need to use to calculate the total of your investment over 10 years is the following:

      Sum([Amount]) * Power(1 + <<interestRate>>,10)

where <<interestRate>> needs to be replaced with the interest rate property.



 If you use this method, you will notice a new syntax, ${propertyName}, has been used to add your property into the expression .This is a preprocessor , which will preprocess the variable and replace it with the value back into the expression. This allows you to use the precocessor syntax in other locations of the expression, if you are familiar with  our expression language, included in the value for the As keyword.

You can now see the second Bar Chart displaying the total of each of the 3 initial investment amounts over 10 days using the default 0.05 interest rate.

 

The final step is to now expose the rInterestRate property to Business Users so they can update the value themselves, thus updating the expression and the second Bar Chart.

 

To do this, we can use the 3.1 Property Controls (new in version 3.1) to expose a property in a form control, which can be set. This is supported in the Text Area. When in edit mode in the Text Area, click on the Property Control button, as shown below and select one of the form controls to use. Assume we want our interest rate to go from 0.0 to .10, we could use a list box, a drop-down list, or a Slider. A slider is probably most appropriate so we will select that.

 

 

When defining the property controls in the resulting dialog, we hook these controls up to a specific property.  In this example, we will attach the control to the rInterestRate property we created earlier.

 

 

Once we do that, we can add a little text before it, and we have a property control which allows users to update the rInterestRate property:

 

If we, for example, update the slider to 0.08, the second Bar Chart will update accordingly:

 

Later on, we can add another property control, this time an input box, to allow the user to adjust the number of years as well:

 

If you are interested getting formal training on all new 3.1 features, please register for one of our 3.1 delta trainings. They are delivered using our blended training model which provides access to asynchronous lectures and demos for 30 days, and then provides access to a live 2 hour webinar to review concepts and ask questions of a live instructor. Exercises and solutions are available as well for people to download and use when they have 3.1 installed, or they can just take the training without doing the exercises (no need to have 3.1 installed to get value from the course). The course is $300 globally.

Topics include new ways to create parameterized applications, enhancements to coloring, including conditional coloring, calling S+ and R scripts and functions, new and updated visualizations and statistical capabilities, API updates, Administration updates.

 
Click here for registration details
.