Forum Discussion

SystemAdmin4's avatar
SystemAdmin4
Qrew Member
5 years ago

Next and Previous Record IDs based on derived sort

Hi.

Table A contains circa 1000 constantly changing records.

The order of records in this table (for various purposes) is determined by a sort field B (numeric formula based upon a couple of other fields). 

Just being able to report the records in the right order in a report is not sufficient.

I need each record to 'know' the record ID of its predecessor record and successor record (based upon the sort field).

I've tried everything I can think of to do this (reverse looks to a master record etc), but can't work it out.

Sure I've seen a solution to something like this in a previous post based upon creating a connected table, but cannot find the post and I'm now pulling my hair out, having tried everything I can think of (reverse lookups - master parent etc).

No doubt I'm missing something obvious!

A nudge in the right direction would be massively appreciated!

Thanks

David




------------------------------
dmlaycock2000 dmlaycock2000
------------------------------
    • SystemAdmin4's avatar
      SystemAdmin4
      Qrew Member
      Hi Mark,

      Yep it's unique - and I've used it to create a connected table with that sortfield as the unique key (with the record ID of the original record in Table A in there too). Both are numerics.

      Feels like I'm heading in the right direction with this but my brain just can't figure out where to go next with this!

      D

      ------------------------------
      dmlaycock2000 dmlaycock2000
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        What happens if you export to another table called COPY table. I am wondering if when you do a saved table to table import it will respect the default sort of the table and the records will come across in the correct sequence.
        If that works you could have a hourly process run by a pipeline which word delete the records in the other table and reload them. You would set the key field in that other table to be the sort field. 

        Then you would have a relationship back to your real table based on that sort field and you would be able to coax the Record ID from your real table up into the Copy  table.

         The records and the Copy table will be sequential. So you can have a relationship of the Copy table to itself to look up the previous or next record ID and then get the record ID from your main table of the previous and next records into the Copy table. 

        Then lookup those Record ID values back down to the main table. 






        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------