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.

Calculation using a formula problem

Featured Replies

  • Newbies

I'm a novice at creating formulas. I need to create a field that will calculate and add the largest five values from eight fields in eight separate tables. This value would be stored in a ninth table. Example below:

Table 1

Field: Weight

Value: 10

Table 2

Field: Weight

Value: 8

...

Table 9

Field: Total of the Five Largest Weights from Table 1 thru Table 8

(Need field calcultion formula for this field)

Any help would be appreciated,

Scooter

Join your Total table to each of the others and specify an 'X' for the join. It doesn't matter which two fields you use - any standard field will work. This will relate your Total table to all records in each table. Your weight fields must be number.

Then within your Total table, create a calculation, number with:

Max(Table1::Weight) + Max(Table2::Weight) + Max(Table3::Weight) ... etc.

If you have a lot of records, this calc can slow things down. I would question having 9 different (same/similar) tables, but that is another story. wink.gif

Hmmm, wait a minute ... you only want the tables added if they contain the top 5 highest values? I think I'd script it crazy.gif or maybe someone else has suggestions. I've seen amazing things with sorting values, particularly Custom Functions. Well, you can create a calculation in your Total Table with something like:

Max(Table 1::Weight) &

  • Author
  • Newbies

I appreciate the help. It's a simple thing to want but complicated to implement. The application actually involves my Bass Fishing Club. We have 8 Tournaments a year wherein you get to count your best 5, thus I want to have the db tell me at the end of the year the sum of the best 5 results of each anglers' 8 tournaments!

smile.gif

Your tournaments contain the same fields, but are distinguished by data within certain fields, ie, Tournament # and/or Tournament Date etc. This data should, in my opinion, reside in the same table. Why? The same reasons you are bumping up against ... because extracting required data is easier if within one table.

Since noone else has responded, I will give you my (almost worthless) suggestion (short of combining them): Write each angler's total score as records into a summary table (so all exist together) and perform your calculations there.

Hi,

This would be easier this way for sure, more reliable on the long term if you have 8 tournament a year...

Your total could be based on the sum of the last items of the ValueListItems for scores for each record, which in turn, has pointed by MoonShadow would preferably be scripted because it can slow things depending on the number of records you have.

  • Author
  • Newbies

Thank you both of you for your time and effort. I'm sure your suggestions will work. Since I'm not a DBA I'm sure this all looks quite amateurish but I volunteered to do this! grin.gif

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.