December 4, 200322 yr 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.
December 4, 200322 yr 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?
December 4, 200322 yr 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)
December 4, 200322 yr 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.
December 10, 200322 yr 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.
December 11, 200322 yr 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
December 11, 200322 yr 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?
December 11, 200322 yr 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.
December 12, 200322 yr 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'.
December 12, 200322 yr 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