1 Reply Latest reply on Apr 8, 2010 12:53 PM by philmodjunk

    Sorting Records with a button



      Sorting Records with a button



      I am using FMP 9


      I currently have a database that has 30 records. Record 1, record 2, record 3.....record 30.


      Each of these records has 5 fields - Record Number, Record Name, Date, Price, Age.


      My layout is in column form.


      This is an example of what I want to happen:


      Change Record 5 to Record 1 and Record 1 to Record 5. Only change the record number but keep all the corresponding info. Then....sort the records so that the new Record 1 (formally record 5) is now the first record (in other words, the records fall back into order but the info for the records that I have renumbered stay with its corresponding record).


      Any way? Any one?


      I have tried to make my explanation as simplistic as I can. Hopefully not too much.



        • 1. Re: Sorting Records with a button

          Point of clarification: You want a button in each row so that clicking that row's button swaps that record for the first record in the list of found records?

          And the record number field is just a number field?


          It's a fairly straight forward script:


          Set Variable [$Rec ; Value: table::record number]

          Set Field [ Table::Record Number ; GetNthRecord (table::Record Number ; 1 )]

          Go To Record [first]

          Set Field [Table::Record Number ; $Rec]

          Sort[Restore; No Dialog]