6 Replies Latest reply on Sep 22, 2013 12:19 PM by psijmons

    Serial Key Resetting

    JimmyMadison

      I have a solution which uses the Serial Key as a Booking Number. Every time I search for a booking number, it seems to be resetting my serial key. When I create a new record the next booking number is the next number after my last find. It make no deference if I use a dialog script or find from the tool bar. I looks as if the serial is taking the value of the last find when a new record is added. I not sure what's going on. Thanks for your help.

        • 1. Re: Serial Key Resetting
          datastride

          Jimmy,

           

           

           

          Is it possible you have a “Set Field” script step where you set the value for the Serial Key field while in Browse Mode, perhaps thinking you are in Find mode?

           

           

           

          #end

           

          Peace, love & brown rice,

           

          Morgan Jones

           

           

           

          FileMaker + Web:  Design, Develop & Deploy

           

          Certifications: FileMaker 9, 10, 11 & 12

           

          Member: FileMaker Business Alliance

           

          One Part Harmony <http://www.onepartharmony.com/>  

           

          Austin, Texas • USA

           

          512-422-0611

          • 2. Re: Serial Key Resetting
            JimmyMadison

            Well not in the find script but I do have one in a script where I can reset the Booking Number. Could this script have a setfield open causing the problem.

            • 3. Re: Serial Key Resetting
              psijmons

              Can you tell how you defined your serial key?

              Increment with 1, unique, not empty, validated, etc.?

               

              Do you also use it as the primary key ID for this table? (usually not a good idea).

              • 4. Re: Serial Key Resetting
                JimmyMadison

                Thanks to all, I beleive I may have found my problem, As for my primary key yes I am using my Booking Number. I do however have all the validation set for a primary key.

                 

                I was having problems where a officer's would start a new record request and would make a mistake in entery. They were deleting this record and staring over which would leave missing Booking Numbers. May have been the wrong thig to do, but I wrote a script to delete the last record and reset last number by 1. Well it sounded good at the time. After that I started have problems with serial key being reset to number of past records.

                 

                I am not sure why this only works on the last record in the file. So I prepared a script if canceled or left  Is(empty) to run a delete record and reset Bookink_ID_PK as follow:

                 

                Allow User Abort [ On ]

                Go to Layout [ "Booking" (Booking) ]

                Go to Record/Request/Page

                     [Last]

                Delete Record/Request

                Set Next Serial Value [ Booking::Booking_ID_PK ; Booking_ID_PK + 1 ]

                 

                I am guessing the problem with this is if an officer has made a search and only the record found was in browse, the delete script would try to take the number of the record in browse mode and add + 1 to it.

                 

                I am thinking to resolve this I must add a line stating "Show All Records" below the Goto Layout statement.

                 

                I have  only been using Filemaker for about a year and intrigued of it's capability and all the talent on this site is a great asset.  All feed back  is welcomed.   JM

                • 5. Re: Serial Key Resetting
                  datastride

                  I don’t think you found the actual cause of the problem.

                   

                   

                   

                  That fix (resetting the serial value) shouldn’t really be necessary, and in a multi-user environment you run the (small) risk of having more than one record with the same primary key.

                   

                   

                   

                  #end

                   

                  Peace, love & brown rice,

                   

                  Morgan Jones

                   

                   

                   

                  FileMaker + Web:  Design, Develop & Deploy

                   

                  Certifications: FileMaker 9, 10, 11 & 12

                   

                  Member: FileMaker Business Alliance

                   

                  One Part Harmony <http://www.onepartharmony.com/>  

                   

                  Austin, Texas • USA

                   

                  512-422-0611

                  • 6. Re: Serial Key Resetting
                    psijmons

                    Well Jimmy, you are learning the hard way that when you start using a primary key for other purposes you will eventually run into trouble.

                    I suggest you make a new field for your Booking number that you can reset at will and that eventually will deviate from your primary key.

                    Make a looping script to fill this new field with the original booking nr and change the appearance on your layouts that use the booking nr to show the new field.

                     

                    Settings for your primary key:

                    Serial number, prohibit modification, validate as unique, not empty

                     

                    For your booking nr you can also set as serial key, but when someone deletes a booking and you want to keep them sequential, make sure this happens only on the last booking number and reset your serial number directly after such a deletion. Do a Show All, sort by booking nr, go to he highest booking number record and reset the serial value. Make sure the booking number field is a real number field, not a text field as these will sort differently.

                     

                    If someone deletes an older booking number, you do nothing.

                     

                    For debugging purposes, you can have your primary keyID in light grey in some inconspicuous area.