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

Featured Replies

Hi,

I want to configure a number field A to be set automatically to:

value of field A in last record + 1

How can I do that?

Tx for helping!

Alain

Max(SelfJoin:A)+1 where SelfJoin is a Self relationship on a constant number of 1 (set to autoenter) or a calculation (still of 1).

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

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

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.

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

Create an account or sign in to comment

Important Information

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

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.