Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hi all,

I have an FM9 database (OS 10.5) that I'd like to include a script step which will reset the serial number in the field definition to 1 (and increment by 1). The file is made of up several related tables and is used for quarterly report data. The main db is a customer info db and then the main related file is a transaction db. Each quarter would get a new customer info record and I'd like transactions to restart the auto serial number at 1 for each quarter. Right now, it's up to 250 or so and instead of manually going into the field definition each quarter to reset, I'd like a script that creates the new customer record and resets the serial # for the transaction records as part of the script. I'm not sure if the "Set Next Serial Value" is the correct step and if so, I'm not sure how to properly se it up.

Any help is appreciated. Thank you!

Posted

Yes Set Next Serial Value could be used to reset the serial number of an auto-serial number field

However...

Please keep in mind that you should never do with with a field that is used a as a primary key. The primary key should always be a unique auto-generated serial that is not reset.

Posted

Thanks. At least I'm heading in the right direction. The serial is not the primary key for the db (I do know better than that B) ). But now that I think about it more, I don't know why I don't just use "@@" for the record numbers and take the field out completely. Duh!

But just as a learning opportunity, I set the calculation for the step to be transdb::record number = 1 and it set the serial number to zero. Why was that? If 1 doesn't set it to 1, then what does?

Thanks again! :thankyou:

Posted

Not sure... It look slike this correct?

Set Next Serial Value [ transdb::record number; 1 ]

Posted

You set it to a calc that evaluates as true (1) or false (0).

Just set it to "1" (no quotes), not "x=1."

Posted

Thanks Fitch! I get it now. And thanks too, John, mine didn't look like what you said. I thought you needed more in the calculation part of the step than just a number. But the change helped, and now it does what I thought it should do.

For this database though, I'm just going to use the Record Number Symbol instead. That's all this one really needed and I should have thought of that sooner. But, sometimes, I just like doing things the hard way.

:Whistle:

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