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.
July 2011 - Posts - Tip of the Week

Tip of the Week

July 2011 - Posts

  • Insert As Text vs Insert As Value

    The concept of Document Properties has existed in TIBCO Spotfire for quite some time.  In version 3.1, the concept of properties was extended and included the ability to expose controls  to allow consumers to change property values.  When this update happened, Spotfire continued to support the old mechanism for adding properties into expressions as well as supported a newer , pre-processor approach.

    The default mechanism, from version 3.1 and later,  for adding properties into an expression is to use the ‘Insert Properties’ button. This will add the property using a pre-processor variable. This will get replaced with the value of the property before the expression is interpreted. 

     

    In addition, there is a right-click menu over the properties pane which allows you the choice to ‘Insert as Value’ or ‘Insert as Text’. The ‘Insert as Text’ is the same as the default ‘Insert Properties’ button.

    The older method for adding a property into an expression is still supported also. This done using the ‘Insert as Value’ method.

     

    This approach is not a pre-processor, rather a function used to insert the property value.

    Why would you want to use this older approach? There are a few situations, specifically when you need to use a specific data type.   We will provide an example below.

    Suppose we want to have a set of property controls that will allow a consumer to specify a minimum data and a maximum date and then have a Spotfire visualization update to only show values within that date range. (I realize this can easily be done with a range filter, but suppose you want to hide the filter panel and expose this capabilities via a property control)?


     
    We will use a technique we introduced in an earlier tip, to have a calculated column update based off the Property control values and then filter the visualization.  To set this up , we have the following expression in our calculated column.                                      

        if((DateDiff("day",[Date],DocumentProperty("maxDate"))>=0) and (DateDiff("day",DocumentProperty("minDate"),[Date])>=0),"in range","out of range")

    where maxDate is the name of the property used for the max date slider control and minDate is the name of the property used for the min date slider control. It is important to use DocumentProperty("maxDate") instead of ${maxDate} as the typecasting will be incorrect with the latter. 

    This will create a new column with values of either 'in range' or 'out of range'. You can then use the filter panel to uncheck 'out of range' so only the data in range will be shown. Then you can hide the filter panel for displaying in the Web Player.

Syndication

Other Spotfire Blogs

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