Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Need help resetting serial number after import

Featured Replies

Here's what I'm attempting: In an upgrade script that imports the user's data from a previous version, I can't figure out how to change the next serial number in the Define menu to the serial number of the last record imported plus 1, so that the next new record the user makes has the right number. Can anyone give me some ideas? Thanks a million.

Use the "Set Next Serial Value" script step.

Just a little point...

The Set Next Serial Value only works on the NUMERIC part of the field...

123 might become 25, however

ABC123 would also become 25

I don't think so. I don't see why "123" should become "25", and you can certainly set next serial value to "ABC123" and have the subsequent new records receive the values of ""ABC123", "ABC124" etc. (though it's best for the serial field to be Text in such case).

Sorry, the "might" become 25 was purely a (bad) example, however I am correct about the non-numeric part of a serial number, see this extract from the on-line help. I also have experienced this too.

The following example calculates the number of the next available invoice ID. If the invoice ID contains non-numeric data, then the calculation would need to be more sophisticated to maintain the numeric and non-numeric data.

Go to Record/Request/Page [Last]

Set Next Serial Value [Table1::Invoice ID; Table1::InvoiceID + 1]

I am afraid you are confusing two separate issues:

Set Next Serial Value [ Table::SerialID ; "ABC123" ]

will work perfectly, and the next two records will be issued SerialIDs "ABC123" and "ABC124", respectively. However, the following will not work very well:

Set Next Serial Value [ Table::SerialID ; "ABC122" + 1 ]

Here the next two records will receive values of "123" and "124". But the reason for this has nothing to do with the Set Next Serial Value[] script step. It fails because the calculation is required to perform a numeric operation on a text value, therefore it needs to convert it to a number first. The correct way to do this is:

Set Next Serial Value [ Table::SerialID ; SerialIncrement ( "ABC122" ; 1 ) ]

  • Author

Thanks everyone for replies to my question. As it happened, I was creating the correct script step, but because I'd tried so many wrong things first, I didn't see that it worked right because of performing an inadequate test. Just knowing that the steps were right led me to see my problem.

Now, my next question: How do I make this function discretionary, so that if there are no imported records the serial number is not reset? Thanks again.

Well, who cares? If there were no imported records, the next value in the table is set to 1. That's acceptable.

But you could add:

If get (foundcount)>0

setnextserial

endif

That'll skip the setnextserial on a table with no records.

  • Author

As it happens, I'm using serial numbers in different tables to "mean" something in various other tables that perform different functions with the data records numbered in certain ranges. If the field were to be set to "1" it would be wrong. Thanks again for quick response.

  • Author

Tried the get (found count), but FM7 doesn't have that option. Is there a workaround? Again, thanx. EFJ

Is your Skill Level Correct?

The Get (FoundCount), [color:gray]which was Status (FoundCount) in earlier versions, and can be located in the List of Function.

Click on the "All Functions by name" [color:blue]tab, and you see the Get Functions listed about 3/4 of the way down. [color:blue]Highlight Get Functions, and a whole bunch of Get functions will appear, including the Found Count.

HTH

Lee

Yikes! Serial numbers shouldn't mean anything.

  • Author

Lee, you're right to wonder about my skill level. I am really quite a beginner at functions I've never found a need for, since I haven't read an entire FileMaker Manual since FM4 (when I was last trained); only learned FM7 on the fly. Thank you for your kind help, Elaine

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.