Business Intelligence Tools

Part 2 – Decomposing Data Functions

This is part 2 of a 7 part series on how to decompose Spotfire projects.  Last week, I started off with a post on data tables and connections.  This week, I am covering how to decompose data functions.  Data functions are quite frequently used to create data tables and can create a lot of complexity in a project.  Thus, the series covers them early on.

Now, each post in the series will be broken down into four sections.

  1. Quick and Dirty (Q&D)
  2. The Extended Version
  3. Documentation
  4. Room for Improvement

The Q&D explains what to look for to get a general idea of what is going on.  The Extended version works to develop an in-depth knowledge of the project.  Each post will also include suggestions for documentation and improving the project.

Quick and Dirty

  1. What are the data functions doing?  Are they creating new tables, new columns, or just transforming data?
  2. What’s going into and out of them? What are the input and output parameters?
  3. Do they work?  It happens that someone attempts to write a data function and it doesn’t work out.  Rather than delete it, they just leave it.

How: Go to Edit > Data Function properties and review the script, input parameters, and output parameters.


First, go to Edit script. Then, Edit Parameters. Finally, hit Refresh to confirm the data function works.



Work thru each tab to understand the data function.


The Edit Parameters dialog provides information on how the parameters are connected to the data in the DXP.

Extended Version

  1. Are the data functions using property controls, filtering schemes, or marking?
  2. Is any code commented out?
  3. Do the data functions use packages?
Data limiting with filtering or marking is shown in the Edit Parameters dialog towards the bottom of the menu.


The # sign comments out a line of code.  When a line of code is commented out, it will not be executed. Sometimes developers comment out code while testing.  Other times, the # sign is use to add comments on what the code does.


Developers commonly attach a package to the library or install the package in the first few lines of code.


The screenshots below were taken from the documentation of two different projects.  One of them I fully documented using a PowerPoint deck.  The slides shown below summarize the usage of data functions. The last screenshot is Excel documentation to show which tables were an input or an output of a data function.


Now, here are a few suggestions for improving data functions in a project.

  1. Add commenting in the data function to improve ease of understanding, especially if it’s a long data function.
  2. Remove unused sections of code to clean up the data function.
  3. Combine data functions where possible. It’s very common for developers to build as they go, but that separate might make the project harder to understand. Consider combining data functions where applicable.
  4. Add descriptions in the data functions if they don’t have them.  This will make them easier to understand 6 months from now.
This screenshot demonstrates adding commenting to translate the object names to table names in the DXP.

Spotfire Version

All content created with Spotfire 7.12.

Well, that wraps up how to decompose data functions.  Next week, we’ll look at how to understand table build and data wrangling.

Leave a Reply

Your email address will not be published. Required fields are marked *