I frequently find the need to update data in a parent table with data from a related child table, but using only the most recent record from the child table.
Here are a few ways I've done it:
child table has self relation sorted by date (descending) with a calculation field IsLatest = If(self_relation_by_date_desc::serial = me::serial; 1 ; "")
same as #1 except the field is a stored auto-enter calc field (so it can be indexed and be much faster). Disadvantage: You have to script this to be updated whenever new records are added to the child table.
Here we want one record to update when a related record updates. No auto-entry solution can work in this case as the wrong record is being updated, therefore the wrong record's auto-entries trigger. A scripted approach is needed.
A child record is presumably the most recent record when it is being committed. I would attach an OnRecordCommit trigger script to the layouts that allow child record modifications or a subscript to scripts that modify the child records. This trigger script or subscript would then update the parent. No need for a calculation.
I would add a "most recent child ID" field and a change flag field to the parent table if I needed the ability to update the parent record at a time after the most recently modified child was modified. Finds would then be limited to the flag field of the parent record. The ID would link the parent record to the most recently modified child record.
The child would be responsible to update the ID in the parent and set the flag. The above trigger script or subscript would take care of the child's updates. The script that updates the parent would be responsible to clear the flag when it updates its own data.
If the relationship is 1:N then targeting the parent record from any of the N child records is trivial. You simply set the fields in the parent record, as there is only one, and the relationship is valid, you will set the correct record.
In your situation, if you start from the Parent.
Go to Related Records ( show only related records )
We wouldn’t recommend sorting within the relationship due to the performance overhead. However, you could have a (hidden) 1 record portal sorted in reverse by timestamp on the parent layout and update this using script triggers.