Triggered Fields vs. Calculated Fields

Triggered Fields are a different type of calculated field that adds flexibility and speed to your apps. Why use them?  For Calculated Fields, each time a view or table is loaded, all the calculations run. This can affect the performance of your application, especially when you begin accumulating more data or your formulas and tables gain complexity. Triggered Fields allow you to run your calculations when you save a record, which allows you to tailor your applications to perform calculations only when needed. Just like Calculated Fields, Triggered Fields can be found in the list of available fields on the edit table page.

When to use Triggered Fields:
1. Retrieving data from a child table (if it isn't a calculated field referencing a parent)
2. Using the {{OLD}} function (see the Text Functions article)
3. Formulas that do not use dates that change as time passes
4. Formulas that do not reference other calculated or triggered fields


When NOT to use Triggered Fields:
1. Referencing another calculated or triggered field
2. Retrieving data in a parent field
3. Using the now() or today() function



Calculated Field Example:
Let's review a scenario when you should continue to use Calculated Fields. 

Your app requires calculations that run on demand when you open your views or records (i.e. calculations based on time functions like NOW() or TODAY() ).  Every time you open a view or form, the calculation will be done at that exact moment guaranteeing accuracy. 

As an example, let’s say you perform maintenance on your company assets.  When you log into TrackVia at 8:00 AM every morning you would like to see which assets are due for maintenance today.  First, take your Last Maintenance Date and add 90 days to it - that will be your Maintenance Interval.  If that date is equal to Today or it is overdue, you would like to know.
The moment the last maintenance date for the asset is updated, the record will get pushed 90 days into the future and will show up in your queue on that date.


Calculated Field Formula:
if(dateadd({Last Maintenance Date},{Maintenance Interval},"d") >= Today(), "Maintenance Is Required","No Maintenance Needed")

Triggered Field Example:
On the other hand, some applications need to run very large and computationally intensive functions, but these functions only need to run when a record is saved or a child record is added.  These types of calculations can leverage Triggered Fields.  

A good example is when you have line items that roll up to an invoice.  The order total needs to be calculated only when you save the invoice.  B
ecause all the sales calculations for the line items will have taken place beforehand, using a Triggered Field to calculate the total invoice value will increase app speed when running reports and opening records related to your sales numbers.

Triggered Field Formula:
sum({Line Items}.{Link to Invoice}.{Line Item Price})


If you have more questions about Triggered fields send the Customer Success team an email at support@trackvia.com or give us a call at 800.673.3302.





Feedback and Knowledge Base