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.

Global calculation not working ?

Featured Replies

I want to display the total count of records of the database, the number of records of the foundset and the number of the record being browsed

so I can display :) record 22th of the 600 found records out of 8000.

In pre FMP 7 I used 3 global fields that were refresh by a script that used set fields and Get function.

Now with FMP7's global calculation, I thought I could declare my 3 globals fields as calculations

Field A -> Get(RecordNumber) as global calculation number

Field B -> Get(FoundCount) as global calculation number

Field C -> Get(TotalRecordCount) as global calculation number

But when I'm on a record B = C. Founset count = total record count ??

The script that just doest set fields steps with the same value does work.

What do you think ?

Edited by Guest

Hi Vince,

It would be simpler to use an unstored text calculation. Something like:

Get ( RecordNumber ) & " of " & Get ( FoundCount ) &

If ( Get ( FoundCount ) < Get ( TotalRecordCount ); " Found"; " Total" )

Otherwise you'll always be trying to keep that puppy updated via script. I usually include whether the record-set is sorted or unsorted. I never call it semi-sorted because it confuses my Users. I consider it unsorted if semi-sorted because it means it should be sorted again before its sort order can be trusted again anyway! :wink2:

Update: Apologies - I see you want the total shown even when only viewing a found set. Change - from the If() forward - to:

If ( Get ( FoundCount ) < Get ( TotalRecordCount ); " Found " & Get ( TotalRecordCount) & " Total"; " Total" )

This last piece is not tested. Watch where the spaces go on it but you get the drift...

LaRetta

Edited by Guest

I wonder, Vince, why you would use globals for this task. It sounds good in theory but not in reality. Globals, by their very nature, must be stored ... even global calculations (which can be good and bad). And yes they are outside the record level but within the table (of dependencies) but they tend to hang back on the record last visited (which can also be good or bad). And it sounds good in theory (using globals) because globals apply to every record in a table. But again, not in reality.

I can't give any other really good reasons. Maybe others can. But an unstored calculation won't need script at all! Calculations which need to update constantly (unstored) including Get() functions need to attach at the record-level, I think. Create this calc once when you create a table and forget about it. :wink2:

Correction: Not last visited ... last edited. There is a difference here. Sorry for my error.

L

Edited by Guest

  • Author

Thanks a lot LaRetta,

I was blinded by theory, since I found it more elegant to use a global that would apply on all records.

I think, at the time (of the fm 5 version of my solution), I was too happy about my discoverry of globals, and never questionned its use afterwards

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.