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.

Get Max field value from multiple tables

Featured Replies

I've got a bunch of tables I have to import records to on a regular basis.

Each table has a numeric ID auto enter serial field.

After importing, the next serial increment in each table is wrong... a number already used.

So after the importing I need to go to each ID field and tell it to use a "next" serial value that is after the last record I imported.

What I want to do is run a script that grabs the hightest IDserial value in each table and plugs it into a field (Global) so I can use it for reference.

Now I've got a feeling there are 10 better ways to do this... but anyway, what I find myself wanting to do in this script is make a loop that goes from layout#1, grabs the MAX for it's ID field, does a Set to put that value in my Global, then go to Get(LayoutNumber)+1 and repeat.

Of course, the hitch is the id field.

They are all the same ("_ID") only w/diff. table names... table:_ID.

So I figured I could construct the field name and get the MAX function to use that.

Max(Get(LayoutTableName)&":_ID")

Won't do it. Wants a field there plain and simple.

Is there any way to get it to do that? Or some other way to get the data I want together in one place quickly?

I also tried

Max(GetField("GlobalWithFieldNameInIt")) and Max($fieldname)but these don't work either.

Apparently Max is fussy about how it gets its field name.

See if this helps.

  • Author

Eureka! Thanks.

I had long forgotten that there was a script step that did this.

# DELETE ALL RECORDS

# IMPORT

Sort Records [ Specified Sort Order: Transactions::Transaction ID ; ascending ]

Go to Record/Request/Page [ Last ]

[color:red]Set Next Serial Value [ Transactions::Transaction ID ; Transactions::Transaction ID + 1]

Of course, I still wish there was a way to use a constructed field name in MAX or GO TO FIELD, etc. That could sure eliminate alot of lines of script.

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.