This came up in Office Hours this morning with @jmlowden, @Amit, and Frank, and I thought it might be helpful to share!
Frank had a use case where an operator can be working on multiple work orders at once (for example, they run out of parts on one WO and then move to a new one) but each operator will only be working on one Part number at one time. He is using a User Table to tie a Work Order number and Part number to a user when they log in. He wanted to be able to then have the Work Order number show up in a different table once an operator finishes the assembly.
Here is how we did this:
-
On the User Table, create a query to filter User and Part Number by app input, sort by latest created, and a limit of 1.
-
Then do an aggregation on top of this using the “Mode” calculation on Work Order number. This allows us to pull the data from the query into an aggregation we can use in our app.
Note: you don’t want to use “Unique Values” aggregation here because that will return an variable array data type. When you are looking for just 1 single value, using mode is the way to go!
- Last, add the query and aggregation to your app and then you can use this aggregation in a trigger to add the Work Order number data to the new table!