Hi all,
I am attempting to sort Gallery items by a value found in a related table.
My primary goal is to sort the stocks in the gallery, with the least recently inspected stock appearing at the top, and the most recently inspected at the bottom. This will help prioritise workflow as you can imagine.
There can be many inspections to a stock.
So,
I would like to sort CashedStocks by the newest available record in CashedInspections
(I am aware that it should have been cached btw, but these things happen!)
Both are Collections
PK in CashedStocks is StockUniqueID
FK in CashedInspections is StockID
I have attempted to use the "AddColumns" function, and this works to a certain extent. It is sorting the Stocks by date of Inspections, but not by most the recent inspection.
I am not sure how to add that layer of sorting to the formula
Any help greatly appreciated
SortByColumns(
AddColumns(
CashedStocks,
"Date",
LookUp(
CashedInspections,
Stock = StockUniqueID,
Created
)
),
"Date",
Ascending
)
Many Thanks