2 Replies Latest reply on Sep 26, 2013 10:03 AM by philmodjunk

    Generate Serial Number for Portal records



      Generate Serial Number for Portal records


           Hello FMers,

           I've a question about generating serial number for portal records.

           There is a way portal records generate serial number and store it by parent table?

           for example if I have record 1 which has 10 portal records, I would like to display 1 to 10 serial numbers on the portal records, and for record 2, instead of continuing with previous records serial numbers, I would like to restart the number from 1 again. 

           Any thoughts? Thanks in advance.

        • 1. Re: Generate Serial Number for Portal records

               You could do this as long as the field you are using to reset is not a pk or fk...  It is best practice to always have your pk and pk with a unique value.

               Setup a 3rd field for your 1-10 numbering and have it reset every time, just don't use your pk and pk keys..

               hope this helps..

          • 2. Re: Generate Serial Number for Portal records

                 Care must be taken with such numbering if there is any chance that two people might be creating records for the same set of portal records. It's possible to get two records with the same serial number in that case--though record locking is likely to lock out one of the two users in most situations.

                 From the context of the parent record, Max ( PortalTable::Serial ) + 1 will return the next serial number in the series for a given set of portal records. You might use a button to create the new portal record that also uses this expression to assign the next serial value in the series.