Max Date from Related Records

Hello Appsheet Community,

I have table sites and table nurseLog. Each row in sites is related to many in nurseLog. nurseLog has a column visitDateTime. I am trying to add a virtual column to table sites that returns the most recent visitDateTime from related records in nurseLog. The column siteID in nurseLog is a ref to the key column UID in table sites.

To put contextually, we have nurses that input logs for their sites. I need to grab the date of the most recent log for each site.

Iโ€™ve tried using MAX() and MAXROW() but canโ€™t quite get it to work. The below sorta works but returns the key column of table nurseLog instead of the visitDateTime

LIST(MAXROW(โ€œnurseLogโ€, โ€œvisitDateTimeโ€, ([siteID] = [UID])))

Any help would be much appreciated.

Solved Solved
0 5 614
1 ACCEPTED SOLUTION

That worked when I wrapped it in a list(). Which your guide said but for some reason I was putting list() within MAX instead of outside.

LIST(MAX([Related nurseLogs][visitDateTime]))

Thank you as always, Steve!

View solution in original post

5 REPLIES 5
Top Labels in this Space