I’ve spent the last two days wrestling with a perplexing problem associated with the following expression, which is designed to retrieve the latest DateTime column [SchedDateTime] in a passenger transportation app. The ultimate purpose is to add an hour to that ‘pickup’ DateTime, thereby automating creation of the subsequent ‘drop-off’ DateTime entry:
ANY( TOP( SORT( SELECT( Schedule[SchedDateTime] , AND( ( [TripID] = [_THISROW].[TripID] ) , ( [TripPart] = “PICKUP” ) ) ) , TRUE ) , 1 ) )
The formula works flawlessly both in detail view of any given record and in AppSheet’s formula workspace ‘test’ feature. It fails however, when in form view to create the subsequent drop-off record. In that view, it appears that either the SORT( or TOP( portion of the formula fails to retrieve the latest recorded [SchedDateTime], apparently pulling the first such record, which is the earliest - not the latest - timestamp.
What am I doing wrong?
Thanks in advance!