Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 6661 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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

Posted

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... ?

Posted

Aha... Solved the problem!! I tend to get stuck with FM:s "vocabulary". The MiddleWords-function was what I was looking for.

Posted

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.

This topic is 6661 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.