5 Replies Latest reply on Apr 30, 2013 7:40 AM by philmodjunk

    Subtract Record No.



      Subtract Record No.


           Hi ...When i try to New Record ..den cancel...its its just clear all the field but i also want to delete new generated record no.means its should have to -1 ...so how can i do this????

        • 1. Re: Subtract Record No.

               Please explain what you mean by "record number".

               Get ( RecordNumber ) returns the position of a record in the current found set so these values will automatically change as you alter what records are present in a layout's found set.

          • 2. Re: Subtract Record No.

                 There is coloum who generate record no..(on ceration time set serial no true.increaseby +1) so now when i cretae new record .den its genrate new no bt then suppose i want to cancel or go back..this new generate record no have to delete so that whenever i try to new record this record no shows previous no..

            • 3. Re: Subtract Record No.

                   If you want a column with the current record number then you would have a calculation field with the calculation Get(RecordNumber), then under storage options, you would click do not store recalculate as needed.   A serial number field auto adds a number, it does not subtract. You would have to manually set the field.

              • 4. Re: Subtract Record No.

                     You can go to "File" - "Manage" - "Database" and then to the "Fields" tab.

                     Then you need to double click the field that creates the serial number and set the next serial number to the number you want to come next.

                     You need to do this manually.

                     If you want to have some sort of numbering that always just adds 1 to the highest number then you need to use a different method. Where you look at the highest number in your table (Max) and add 1.

                     This can be handy for invoice numbers where you can't have any gaps.

                     Then it doesn't matter if you add one and then delete one, you'll still get the next number.

                     But you'll still have the problem that when you create Nr "1", "2" and "3" and then you delete number "2" the next one will still be "4" so you will have a gap because you deleted "2".

                     If this is what you are looking for and you need any more help, just let us know.

                • 5. Re: Subtract Record No.

                       In some cases, it works to set up the auto-entered serial number to be generated "on Commit" rather than "On creation". This delays generating the serial number until the first time that the record is committed. If you revert the record to "cancel" no serial number is generated and thus no gap is generated. But this can prevent access to related tables that link to that serial number field until you first commit the record, so this does not always work.

                       DaSaint's suggestions are worth investigating, but keep in mind that if you have multiple users all creating new records at the same time, these methods can have a significant risk of getting two records with the same value unless you design your system with some extra validations to catch the creation of duplicate values.