Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Finding last edited record AND stay sorted


This topic is 7651 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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
Posted

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)

Posted

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.

Posted

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.

Posted

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

Posted

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
Posted

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

  • Newbies
Posted

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.

Posted

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

This topic is 7651 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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