Buttons: next entry, past entry

I have an app where people can input information. Each row of information receives a timestamp. I now want to be able to navigate from the detail page of one piece of information straight to the next one (based on the timestamp) or the one before.

It is not possible to add an incremental number to each row at save time (because some rows are coming through the API). If that was the case, it would be easy (I could do a relationship in the row for the number after this number’s row and than use that relationship to create a button to the related item).

It’s easy enough to dynamically generate row numbers, but I would suggest that isn’t a good solution here. This is because you probably cannot guarantee that rows will be added in chronological order. That is especially true if rows are added via the API - because Glide does not guarantee that rows will be added in the same order that they are recieved.

My suggestion:

  • Create a Query column, target it at the table that contains your data, and apply the following:
    – Timestamp is after This row → Timestamp
    – Order by Timestamp in ascending order
  • Add a Single Value column that takes the first RowID from the Query
  • Use that RowID to create a single relation to each Row
  • You can then use that Single Relation as the target of a Show Details Screen action.
1 Like

You could technically do the row numbering technique with a sorted query, couldn’t you? A lookup on the query would return the row ID array in that sorted order so you could proceed with the indexing.

Yeah, I think that would work, but does it actually save anything? :thinking:

Worked like a charm! Thank you very much! :smiley: