Hi,
I have 3700 records from a comic book puzzle collection database
I want to add an index field for classifying boxes according to the collection theme
examples:
Asterix = AST
Lucky Luke = LLK
etc…
I would like this field to have a three-digit sequential number and to be notified if it is already used for a theme
Example: AST001 is already used, I must use AST002
Is a script possible for this kind of request?
Thanks in advance
The trickiest part of your request is to be notified if your sequential number has already been used or not. One way achieve that would be to have a Field script loop through all your records, searching for the value that you just entered and then displaying an alert message. But it could take a while for 3700 records.
But the formatting of an index number prefixed with 3 characters would be easily achievable with a Number field with the Auto-increment function enabled and a Calculation field that joins them together using the FORMAT() function.
For example:
PREFIX + FORMAT(Number; "000")
The FORMAT() function will take the Number field and format it so that it contains prefixed 0’s.
Attachments:
You must be
logged in to view attached files.
I’m not certain that Brendan’s approach works as expected. The auto-increment number would be independent of the prefix. So you might end with AST001, LLK002, AST003, …. But AST002 would not exist.
I would use a form script that provides you with the next valid entry. Create a saved search for your prefix’s, and then have a form script analyzes this subset of records and recommends you the next valid number to be used. I do this with barcodes that I assign to my artwork.