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.

Finding last edited record AND stay sorted

Featured Replies

This must be simple, but I just can't figure it out.

All I want to do is show the last touched record (new or edited) and list all records sorted in order.

Let me explain: I've added a button (save) which runs a script. In this script I want to save the current record then sort all records in the database on a date field and then display all records sorted by date with the last touched record showing.

I can find the correct record using a flag [could not get status(currentrecordid) to get me to the correct record] or I can sort all records based on the date field. But I can't seem to get both at the same time. Any help would be greatly appreciated.. thanks in advance.

Show All Records. Sort by a modification date/time stamp (ascending). Then Go to Record/Request/Page [Last].

If this doesn't work for you, elaborate on "all records sorted in order". What order exactly?

  • Newbies

Try this: Define a relationship from an IDglobal to an ID.

In the script, set IDglobal to ID.

Save, find and sort at wish.

Go to related record (IDglobal to ID, show only related off)

In list view, you would want to add scroll down and scroll to location to ensure that the record is actually visible (top of the list).

(The record has to be in the found set, else FM will show all to display the related rec - and unsort)

  • Author

True this will work if the recorded added is the latest date. But the record added could be any date..so the record I need to display maybe in any position in the database.

Not true, the modification date/time ascending sort will make the last 'touched' record the last. The second-to-last 'touched' becomes the penultimate record, etc.

  • Author

True that works for sorting the records on Modified date.

But what I'm after is it to sort on the date entered in the date field. When you move ahead or back it is the next record based on the date in the date field.

For Example: I have these records already in the database sorted on the date entered into the date field

12/02/2003

12/04/2003

12/05/2003

12/06/2003

I now enter a record 12/03/2003 in the date field. Once I hit the save button I want the records showing like this.

12/02/2003

12/03/2003 <-- with this record up on the screen

12/04/2003

12/05/2003

12/06/2003

Ah, so you mean date of service. "Date field" is a bit ambiguous.

In that case, Show All Records, Sort1 [Restore, No dialog], Go to Record/Request/Page [Last], Set Field ["gtext", "serial"], Sort2 [Restore, No dialog], Go to Related Record ["self"].

gtext is a global text field. The quotes around it and serial are unnecessary, but this is how you would see it in ScriptMaker. Make your Sort1 based on modification date/time and Sort 2 based on date of service. Perform both as subscripts called by the main script. Make 'self' a self-relationship from gtext to the serial id field.

Will this work for you?

  • Newbies

That's just actually just what I tried to suggest in the first place.

  • Newbies

Sorry, that was a bit too short: The first part of your script is only necessary if the user will not hit the save button from the record you want to come back to. Else, you can simply start by setting the IDglobal to ID (Your "Set Field ["gtext", "serial"]") and the script I suggested will be completely sufficient. And it doesn't require nested scripts.

True. I was thinking of a multi-user scenario, in which the sort would be necessary, from the original question. But, then we find out he's not asking for what he really wants. The last record modified by the current user is definitely not necessarily the 'last touched'. wink.gif

  • Author

Sorry for the confusion. Thanks Queue, that was what I was looking for. Works like a charm.

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.