Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Create a new sort order without modifying the primary keys

Featured Replies

A Relational Database has records with a Primary Keys as serial numbers from 1, increasing by 1 with each record. I want to have the database modified later so that I can add records between already present records.

Say on September 1, 2007 my db has records with serial number 1 to 5. On September 4, 2007 I want to add a record so that it always comes after record 4 in the database. Rather than modifiying the entire column of PKs to accomodate the new record after record 4 how do I calculate a new serial number for the record set so that the set can be sorted based on this calculated serial number.

PK RecordName NewSerial

1................John

2................Charlie

3................Echo

4................Mathew

5................Nancy

If I now create a new record with PK 6 and want it to appear in position 2, what calculation or script should I do?

PK RecordName NewSerial

1................John...................1

2................Charlie................3

3................Echo...................4

4................Mathew.................5

5................Nancy..................6

6................Alpha..................2

How about just sorting the found set every time you navigate to the layout (this can be scripted easily). Presumably there's something about "Alpha" that makes him/her come in second, so sort on that field.

  • Author

More clarification on the question soon..

  • Author

Got the answer and done the script.

Its probably better to go by trial and error than waste time clarifying things so the database engine can eat my posts.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.