When do equations and pipes run?

This question is about equations and pipes.

Do I understand it correctly that equations only run in a data table, when you change a field in that data table? This means the equations don’t update when you display information from the table in a details view.

To enforce the calculations are being run, you add an automation (like daily) which changes something in the table. I usually use a date field, which is updated with Today() every day.

I am also using a pipe somewhere which calculates a birthday. How does this work? Is the pipe run when you display the birthday (from the pipe) on a details page, or is the pipe also only run when you change a field in the data table?.

Thanks for clearing this up (@moe @tim.young ?)

Hey @Peter

The best way to describe this process is through the use of a Form Component. The image from this article is super helpful.

To answer your first question, Equations do not auto-refresh as an isolated value. Equations are dependent on the record values they are calculating on, meaning if you have this Equation…

NOW()

This equation is not constantly polling for the current date/time value. This function is unique in the sense that it implies that it would, but since Equation functions are always dependent on record values, the record/table has to be refreshed. The whole equation updating process is actually really cool and complex. Maybe @moe can add some more insight here. Here’s a brief overview of changes we made to this process about 2 years ago.

Referencing the image above, from the moment a Form is submitted, Equations are not processed until after Record and Table Rules. The practical implications of this are things like not being able to use an equation in a record rules, because the most current value of the equation hasn’t calculated yet.

So how do Pipes fit in here? Generally speaking, Pipes are always triggered by something, which is why you see them being available inside of Rules. The rule fires, the Pipe is told to do something, the response is received and used as you need it. Pipes can run in different locations and it does get a bit tricky depending on where the Pipe is triggered but for all intents and purposes, let’s assume that Pipes will always run where they are triggered. For example, if a Pipe is in a Table Rule, that’s where and when it runs - ie. when a record is created or edited.

I’ll take this time to plug these Tadabase Academy videos.

Hope that helps! Definitely a great conversations for others to see as well :smile:

Follow-up questions to make it clearer by examples @tim.young :

Question 1 about equations;
If I had an equation in my table which needs to be updated every day, I would do an automation which runs every day.
Does the equation run when the equation does not have the by automation every day updated field, in the equation? Yes or no.

(In other words, when I touch the table by updating a field, does this trigger all the equation fields within the same table?)

Question 2 about pipes
So, when I have a details page, on which a piped value is shown, just by rendering this page in the browser, it will fire the pipe and therefore the value gets updated always? Yes or no?

Question 3 about age
Displaying an age based on the birthdate value in a user data table.
If I use the Tadabase Date Utilities pipe, it will always have the actual date on showing the page in the browser, as it fires upon showing the piped age field. Whereas if I used a calculated age field in the data table to show in the application, it would need to be updated by a value change of one of the fields in the data table or even of a field in the equation. (to be very time accurate).

So using the date utilities pipe is far more accurate to show a persons’ age in any application and requires less programming/planning/thinking. Yes or no?

Thanks for clearing this up with a concrete example.

1 Like

@tim.young reminder