
November 04, 2025
Select an option to view the article tailored to your learning style
For those who want to dive deep into the technical details
For those who want to understand the big picture
Few minutes read that gives you the high-level points
You can watch the full video below.
Data functions are one of those features that sit quietly in Spotfire, and most people don’t truly appreciate what they can do because the setup looks a little intimidating at first glance. But once you understand their structure, they become one of the most reliable ways to organize logic inside a dashboard, especially when you're building tools that need to do more than what a standard calculated column or custom expression can handle.
The easiest way to think about a data function is that it sits between Spotfire and whatever logic you want to run. Spotfire gives you the inputs, whether that’s a table, a column, a document property, or even a subset of marked data. Your script does the work, filtering, aggregating, running anomaly detection, applying business logic, or even reaching out to an external API, and then Spotfire captures the outputs and updates your visuals instantly. Once you understand that flow, the whole feature becomes a lot less mysterious.
At the core of every data function is a simple but powerful structure: Spotfire provides the inputs, you write the logic, and Spotfire maps the outputs back into the dashboard.
Inputs can be anything Spotfire exposes.
You can pass in a full data table, a filtered subset, a specific column, or even just a document property the user typed into a text area. Spotfire treats each of these as a named object, and once you assign that name, you can reference it directly inside the Python or R script.
Logic is whatever your workflow requires.
Because this is real Python or R, you have full control over how the data is shaped. You can add new columns, clean the data, run machine learning models, compute forecasted values, run economics, or simply apply a transformation. Spotfire hands you a pandas DataFrame when you pass in a table, so everything behaves exactly as you'd expect in a normal Python environment.
Outputs are how you push the results back into your dashboard.
You decide whether the script returns a new document property, a new table, or updates an existing one. Spotfire handles the mapping for you, so you always know exactly where your results will appear. This structure makes the logic highly reusable and a lot easier to maintain than scattering calculations across multiple layers of expressions and calculated fields.
When you open Data → Data Function Properties, you can create a new function and walk through the setup. You select whether you want to use Python or R, specify any packages you might need if you ever plan to deploy this on your server, and write a short description of what the function does so other users understand how it fits into the dashboard.
Spotfire also gives you the option to enable caching. This simply tells Spotfire not to re-run the script if the inputs haven't changed since the last time. If the function does something computationally heavy, caching can save a lot of time because Spotfire will return the last known output instantly.
The script editor itself is fairly basic because Spotfire doesn’t offer IntelliSense or the kind of interactive development you'd get in VS Code or Cursor. In practice, most people write and test their scripts outside of Spotfire, then paste the final version back in once they’re ready. I’ll cover my full workflow for this in a separate video because it makes development significantly easier.
In the input section, you define the objects that your script will receive. For example, you might add an input called data, set its type to “table,” and allow it to bring in all columns. This means that inside the script, you’ll be working with a pandas DataFrame called data, which you can manipulate however you want.
Spotfire also allows you to pass in filtered rows, apply a specific filtering scheme, or pass in only marked records. This becomes very powerful when the workflow depends on the user's on-screen interaction, such as selecting wells to forecast or marking outliers before running anomaly detection.
Inside the script, you can do anything you'd normally do in Python. In the simple example from the video, you created a new variable called test_property and added a new column to the DataFrame with a value of 1 for every row.
It’s a small example, but it perfectly illustrates the main idea: Spotfire hands you the data, you transform it however you want, and Spotfire will use whatever you output. This pattern is how more complex Spotfire apps are built, whether you're layering multiple data functions, orchestrating logic with document properties, or structuring entire workflows inside the dashboard.
On the output side, you define how the results of your script should return to Spotfire. This is where the mapping happens.
For example:
test_property becomes a new document property called test resultSpotfire then takes over from there. It creates or updates those objects every time the data function runs. This makes it incredibly easy to see exactly what your script produced. You can open a table visualization, inspect the new column, check the document property, and confirm the entire cycle ran as expected.
Spotfire gives you control over when the data function should run. If you enable automatic refresh, the function re-runs whenever the inputs change. If you're doing something heavier, like economics or forecasts that depend on multiple user inputs, you usually want the user to configure everything first and then manually click a “run” button. The decision depends entirely on the workflow.
If you're preparing this for deployment on your company’s server, the run location setting (local or server) becomes important. For now, default settings work fine, but when you start pushing these dashboards to production, you’ll want to make sure the server environment has access to the same Python packages your logic requires.
After running the demonstration script in the video, Spotfire immediately generated a new table with the additional column and created a new document property with the expected value. Updating the script and clicking refresh showed that the changes took effect immediately, which confirms the full loop is wired correctly.
This is the foundational pattern for every advanced workflow you build with data functions.
Once you understand the mechanics, data functions become your best friend for anything that goes beyond basic expressions. They give you a clean place to put logic, and they allow you to build internal tools that behave like lightweight applications, all inside Spotfire.
You can run more structured transformations, remove layers of messy calculated columns, tie your logic directly to user inputs, build forecasting tools, integrate with external APIs, or perform processing that would never be possible in standard Spotfire expressions.
This is where Spotfire starts feeling like a proper development environment instead of just a visualization tool.
Data functions open the door to some of the most powerful and flexible capabilities in Spotfire. They let you pull in real Python or R logic, manipulate data on the fly, and return structured results back into the dashboard in a way that is repeatable, transparent, and easy to control. The moment you start using them, dashboards that once felt rigid and limited suddenly become dynamic, interactive, and capable of handling far more complex workflows.
In the next part of this series, we’ll start exploring how to build more advanced data functions, how to chain them together, and how to combine them with document properties and IronPython to build internal tools that behave like full applications.
If you want help building these kinds of workflows inside Spotfire or designing app-like tools for your teams, feel free to reach out at info@aai.agency.