aai agency logo
Newsletter header images

Data Function Basics in Spotfire

November 04, 2025

Choose Your Learning Style

Select an option to view the article tailored to your learning style

  • Technical

    For those who want to dive deep into the technical details

  • Curious Learner

    For those who want to understand the big picture

  • Short on Time

    Few minutes read that gives you the high-level points


Curious Learner TLDR:


You can watch the full video below.


  • What Data Functions Are: They let Spotfire run Python or R behind the scenes so you can reshape data, clean it up, or add new calculations without building complicated formulas inside the dashboard.


  • Why They Matter: Instead of stacking logic in different places, a data function keeps everything organized in one spot. You give it the data, it does the work, and Spotfire brings the results back into your visuals.


  • What You Can Do With Them: You can filter or transform tables, update a value based on user input, create new outputs for your visuals, or run more interesting workflows that Spotfire cannot do on its own.



Spotfire Data Functions Explained in a Simple Way


If you are new to Spotfire or have only used the basic features, data functions might feel like something for advanced users. They show up in the menus, but most people never touch them because the setup looks more complicated than it really is. Once you understand the idea behind them, they become a very natural way to help Spotfire do things that go beyond what is possible with built-in tools.


At a simple level, a data function is a small piece of Python or R code that Spotfire can run whenever you need it. You give it the information it needs, such as a table or a value that a user typed in. The function runs your logic, and Spotfire updates your dashboard with the result. It is like giving Spotfire a small custom engine that can do whatever your workflow requires.



Inputs, Logic, and Outputs in Plain Language


Every data function follows a very familiar pattern. You give it inputs, it runs some logic, and it returns outputs you can use in the dashboard.


Inputs are the things you want Spotfire to pass into the function. This can be a full table, a selected column, or even a little text box value that the user changes at the top of the page.


Logic is simply the work the function performs. It can add a new column, calculate something, clean up the data, or detect patterns. Because it is just Python or R, you can write exactly what you need instead of trying to force everything into a Spotfire expression.


Outputs are the results you want to see back in the dashboard. This could be a new table for a visualization, a single result stored in a document property, or any value the dashboard needs to update the analysis.


Spotfire takes care of passing the inputs in, running your script, and putting the outputs wherever they belong.



Registering a Data Function Without the Intimidation


When you create a new data function in Spotfire, you pick whether you want to write it in Python or R, give it a name, and then write a short description of what it does. The important part is choosing what the function should receive as inputs and what it should send back as outputs. Once you save it, you can choose whether it should run automatically when something changes in the dashboard or only when you tell it to.


You can use this feature to do simple tasks, such as adding an extra column to a table, or more involved tasks, such as pulling together inputs from users and preparing the data for something more structured. The entire setup is just a clean way to group your logic in one place instead of scattering it across multiple expressions.



Seeing the Function Come to Life


In the example used in the video, the function created a new document property and added a new column to a table. When the function was run, Spotfire immediately generated the updated table and the new value, which made it easy to see the entire cycle in action. You could then change the script, refresh it again, and watch the results update right away.


This is the basic pattern for every data function you build. Once you see it work one time, the whole feature becomes much easier to understand.



Where Data Functions Really Shine


Spotfire already does a lot out of the box, but data functions are what let it feel more like a true application builder. Instead of relying on a long chain of calculated columns or complicated logic hidden inside expressions, you can keep everything in one clear place and let Spotfire handle the rest. This becomes incredibly helpful when your work involves planning tools, forecasting, anomaly detection, or workflows where users need to interact with the data and see the results update instantly.


They also make it easier to maintain the dashboard because all the logic lives in a single script instead of across dozens of places.



Wrapping Up


Data functions allow Spotfire to go from a visualization tool to something much more flexible. They bring in the power of Python and R, they help you keep your logic organized, and they make it possible to build interactive, app-like experiences inside a single dashboard. Once you understand the simple loop of inputs, logic, and outputs, the entire feature opens up.


If you want help designing one of these workflows or you want to explore how to use data functions for internal tools, you can always reach out at info@aai.agency.