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.

Maybe this?

MAX([Related nurseLogs][visitDateTime])

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!