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 6278 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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

Posted

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

Posted

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]

Posted

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 ) ]

Posted

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.

Posted

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.

Posted

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.

Posted

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

Posted

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

This topic is 6278 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.