Example of Property Controlled On-Demand Data


The data that is to be loaded on demand can be controlled in a number of ways. See Loading Data on Demand for more information. The example below uses a property control in a text area to select which data to display in a bar chart based on an on-demand data table.

In this example, we first assume that we have a data table containing a string column called "Type" which lists a number of different product types loaded in the analysis. We also assume that there is a data connection with some additional data available, which also contains a "Type" column. See Adding Data Connections to an Analysis or How to Work with Data Connections and their Data Sources in the Library for more information about connections.

To add an on-demand data table using input from a document property value:

  1. On the authoring bar, click Files and data .

  2. In the Files and data flyout, locate the data source (an information link or a data connection) of interest by searching for a suitable keyword or by browsing the different categories. In this example, we use a data connection.

  3. When you have selected your data, you will see a summary view showing how the information link will be added; the Add data to analysis summary. Click on the new data to enable editing of the settings. Make sure that the new data is added as a new data table, if this is what you want.

  4. From the drop-down list, showing Import or External, select On-demand.

  5. Click Configure.

    Response: The On-Demand Settings dialog is displayed.

  6. In the Define input for parameters that should control loading list, click to select the column containing the product types ("Type").

  7. Click Define Input.

    Response: The Define Input dialog is displayed.

  8. In the Input for the selected parameter list, select Values (fixed/properties/expression).

  9. Click the Property radio button.

  10. Click Select.

    Response: The Select Property dialog is displayed.

  11. If no suitable property is available, click New in the Document Properties tab.

    Response: The New Property dialog is displayed.

  12. Define a string property using one of the available product types as default value. For example, create a string property called "Type" with the value "Apples".

  13. Click OK in all dialogs.

    Response: The on-demand data table is loaded using the limiting default value and can be used in visualizations. In the example below, the visualization shown is a bar chart displaying the sum of sales for Apples in four different regions.

To add a property control for changing the document property to a text area:

  1. Create or activate a text area.

  2. On the title bar of the text area (or in the right-click menu) click Edit Text Area .

  3. In the Edit Text Area dialog, type some descriptive text to help other users understand what the control will do.

  4. Click on the Insert Property Control button, , and select which type of control to add. In this example we will add a drop-down list.

    Response: The Property Control dialog is displayed.

  5. Select the previously specified document property.

  6. Select Set property value through: Unique values in column.

  7. Select the Data table to be the first data table in the analysis (not the on-demand data table).

  8. Select the "Type" Column.

  9. If desired, you can limit the values to be displayed in the drop-down list using a search expression.

    Comment: Only those values matching the search expression will be shown in the control. See Searching in Spotfire for more information about valid search expressions.

  10. Click OK and, in the Edit Text Area dialog, click Save before closing edit mode.

    Response: The property control is added to the text area.

You can now use the property control to change which product type to look at in the visualization. If Load automatically has been selected in the on-demand settings, the visualization will be updated each time the property is changed via the control. If Load automatically has not been selected, a refresh button will be displayed on the title bar of the visualization each time the input is changed.

See also:

Using Properties in the Analysis