Using Table Aggregations in If Statements on Triggers

hello all,

I wanted to share a simple way to use Table Aggregations in the if statement within your Triggers. in this example, we’ll look at the number of open Work Orders Table and display this in a simple message that changes if there are more than 1 open work orders. using this simple logic, you can enable a lot of advanced workflows in your Apps!!

the logic is as follows: if # of open work orders >= 2, then show: “there are x open work orders”. else show: “there is 1 open work order”.

here’s our Table:

that has the following Table Query to Filter for Open Work Orders (Complete = No) and a simple Count Aggregation:

from our App, we can now link the Query:

and display the Table Aggregation in our App:

last thing that’s left to do is add a Button to check the value of the Table Aggregation:

and now, you can see the Message changes depending on the number of Open Work Orders:

of course, this is a simple demo to display the functionality of using Aggregations in Triggers, but there is a lot of functionality that can be built into your Apps using this logic!!

let us know if you have any questions!!