Guia do Usuário do Cliente Web Spotfire®

Configuring data functions

When you run a data function, you must define how the input and output parameters of the data function definition should be handled within your analysis. It is necessary to specify a mapping of all required parameters to Spotfire, to use the data function in an analysis. This topic contains details about different configurations that might be available when running or editing a data function in the web client.

Before you begin

Data functions have been created using the installed Spotfire client and saved in the library.
Note: All of the required inputs and all outputs (except those you explicitly exclude in the summary view) must be configured to run the data function. Optional inputs can be left without being configured.

Procedure

  1. Follow steps 1, 2 & 3 in Running data functions in Spotfire web clients.
  2. If the data function is designed to use input parameters to determine on what to base the calculation, you must configure your inputs.
    For example, this could be a value, a column or a data table that you select from your analysis. Not all data functions require inputs, and there might also be cases where optional inputs can tweak the result from the calculation. It is the author of the data function that determines what you need to provide, by specifying the input type and what is required.
    Tip: If there are many inputs in your selected data function, and only some of them are required, you can click Always show required inputs first to move optional inputs to the end of the list and hide them.

    Inputs:

    You will not be able to select from all of the input types described below when specifying the input for a selected parameter; you only see options that are applicable to the current data function and your analysis.

    • Data table – select a data table using the drop-down list.

      (The data table selector is often a first step before selecting one or more columns, but, it can also be a separate input type. In this case, the input type only lists data tables where columns of all data types are allowed as inputs to the data function. If you cannot find the desired data table in the list, you can instead use the Columns option to select all columns of allowed data types from a specific data table.)

    • Column – select a single column from the specified data table using the drop-down list.
    • Columnsselect one or more columns in the Select columns dialog.
    • Search expression – select a number of columns based on a search expression (press Enter to perform the search). This option is useful if you want to select many columns that, for example, start with the same letters.
    • Custom expression – specify your own expression in the Edit expression dialog.
    • Value – type an input value. The value is generally accompanied by a data type selector, where you can change the data type for the entered value.
    • None – no input handler has been selected or no default exists. This can be used for optional input parameters. If the input parameter is required, you must specify an input to be able to continue.

    The Limit by option allows you to limit the calculations based on column values or data tables to rows matching a specified combination of filterings and markings only. If more than one option is selected, then calculations will be performed for rows matching the intersection of the selected filtering and markings only. Do not add any limits to base calculations on all rows.

    Tip: When a data function instance has been added to an analysis, and the outputs are columns or rows used in a visualization, you can tweak your input values directly from the visualization, and quickly try out different input values. You can also edit input and output parameters from the Data functions in the Data canvas view.
  3. Determine whether to Refresh function automatically.
    Select this check box to update the results from the data function automatically each time the input settings are changed. If the check box is cleared, a manual refresh is needed for any updates to take effect. Refresh can be done from the Data function properties dialog in the installed client, or, a Spotfire Analyst author might add an action control to refresh from a text area.
    A data function configured to load automatically will switch to manual update if cyclic dependencies are detected in the analysis.
  4. Click OK when you are done with the inputs.
  5. The configuration of outputs determines what to do with the result from the calculation. For example, you might get a new data table, new columns or rows, or, a document property value that can be used to define a line in a visualization, or similar. Which types of output are available depends on what your selected data function produces (Value, Column or Table), and what you currently have in your analysis. For example, if you do not have a data table in your analysis when running the data function, the only option you will have is to add a new data table. Once you have a data table, more options can become available.

    Outputs:

    • Add as new data table – create a new data table.
    • Add as rows to the specified data table. See Adding rows to a data table for more information.
    • Add as columns to the specified data table, using a join operation. See Adding columns to a data table for more information.
    • Add as calculated columns to the selected (final) data table.

      If you have chosen to limit the input to marked or filtered rows only, the Map result to limited rows for option lets you specify how resulting values should be added to the data table. If this check box is cleared, the results will be added to the first rows in the specified data table, but if you have chosen to calculate results for filtered values only, you probably want to add the results to those rows that were filtered when the calculation was performed instead. Select the input parameter to match against from the drop-down list.

    • Replace data table – replace a previously added data table by selecting it from the drop-down list.
    • Add as document property value in the analysis. You can either define a new property or update an existing one. Note that if you define a new property, it will not be created until the data function has successfully finished its execution.
    • Add as data table property value – select a data table and create or update a data table property.
    • Add as column property value – select a data table, a column in that data table, and create or update a column property.
  6. When you are done, click OK.