Jump to content

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

Recommended Posts

Posted

This assumes that the value in the last record is also the maximum value for the field. Will that always be true?

Posted

True !

I'm so use with this using with serials...where (in my solutions), they never get deleted.

Then you could use an unstored calc with c_latestSerial =Max(SelfJoin::serial), and relationship from that calc to the serial field, call it RelByMaxSerial

So that the max A value would be (RelByMaxSerial::A)+1

Posted

I have used this Max(Selfjoin::Serial)+1 method on a couple of projects and have now gone back and removed it because we noticed that after getting a bunch of records into the database, things were slowing down dramatically. Mind you, there were some other things happening too that were partly responsible.

Also, if this is a multi-user application, it's guaranteed that you will eventually get unwanted duplicates as two users try to create a new record at the same time.

Posted

From what I read of the question, it's not clear what they want; but it doesn't sound like a Max of the field (which is as you say, slow as toast).

It sounded like they wanted to add 1 to the value in a field of the "last" record. Assuming that "last" means the previous record in creation order, then the simplest method is to just go back one record and get it, then go forward one.

If however you need to do this with a scripted loop in a large found set, there is a more advanced method of looking up the serial ID of the "previous" record, using a self-relationship.

Ugo and I recently did this for LaRetta. The Subject was "Modify Line by Previous."

Example file:

http://www.fmforums.com/threads/download.php?Number=92032

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