3 Replies Latest reply on Jun 27, 2011 1:05 PM by mgores

    Auto Indexing after a sort

    ApRamos

      Title

      Auto Indexing after a sort

      Post

      Hello all. I am new to FM and am having some formatting issues. I need to index records after they are sorted by date. This index number then needs to be diplayed within the record. Does anyone have any suggetions?

        • 1. Re: Auto Indexing after a sort
          mgores

          create your index field, make it a number.  Place that field on your layout where you want it to show up.  Do your sort.  Click in the index number field then select Records/Replace field contents with serial number.  Now there is a serial number for each record.  Then go to manage database and change the field definition for the index field to auto enter serial number, starting from the number in last existing record plus 1.  Now that number will auto enter as you creat new records.

          • 2. Re: Auto Indexing after a sort
            philmodjunk

            Replace Field Contents with the serial number option would also be my first choice, but I'm adding a few words of caution:

            If this is a networked solution and two users try this at once, you can easily get scrambled indexes if both users attempt to assign the same record different index numbers. Also, if another user is currently editing that record, replace field contents will be unable to assign it an index number, the user will see an error message that one or more records could not be updated, but you won't be able to tell from the message which records were not successfully updated.

            Thus, this is a method that is much safer to use on either a single user solution, or when run after hours as a maintenance routine scheduled to run when no other users are accessing the database.

            • 3. Re: Auto Indexing after a sort
              mgores

              Yes, you would want to make sure no one else was adding fields or entering numbers while you were working on that.  And I am assuming that you wanted them in a specific order so having one or two getting skipped would definitely be an issue, so you would want to make sure no one else was logged into the DB.