October 29, 200619 yr I need to generate unique serial numbers in a limited range (lets say 100 -999). Since the range is limited it would be important to be able to reuse deleted serial numbers. Let´s say record 1 in a database gets sn. 100, record 2 gets sn. 101 etc. If I delete record 1, sn. 100 ought to be free to use... if I only could get a script to apply this to the next new record. Greatful for help }:|-) PS. I´m using FM 6.
October 29, 200619 yr Create a global field named Serials. Create script with a loop and fill Serials field with you range of serial numbers ( return delimited list ). Then create one script to add data and second to delete data. In add script you grab serial number from Serials field with help of text functions ( also substitute it with "" so it dissapears from list ). In delete script just grab current record serial, put it back in Serials field and delete record. HTH
October 29, 200619 yr Author Thank you DukeS, for your reply. I do follow your thoughts, managed to make a loop script to fill the Serials field with my range (is it ok with ", " as separator (1, 2, 3, 4, 5, ...) ?) but... I´m not good enough to figure out the syntax for the adding and deleting values from my Serial field. Any chance you could elaborate a bit... ?
October 29, 200619 yr Author Aha... Solved the problem!! I tend to get stuck with FM:s "vocabulary". The MiddleWords-function was what I was looking for.
October 29, 200619 yr I am glad you made it... For list of your serials I would suggest you to use return delimited list like: serial1 & "¶" & serial2 & "¶" & ... lastserial This gives you list like: serial1 serial2 ... lastserial instead of 1,2,3,4,... It is easier to manage and read but I am not sure if FM6 has functions like MiddleValues to manage return delimited lists.
Create an account or sign in to comment