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 of Related Record

Featured Replies

Hi


I need some help on the calculation of record count of related record in the Main page where related records from a single input form.

Thanks in advance
Ken Chan

TEST.fmp12

A couple of things to consider when posting so that you'll get the maximum help:

- describe the problem in your post, perhaps we can help by the description without having to download a file first

- for your file, describe what field you want to change and what it should do (count all related records, count only some records,...)

 

Doing a count is as simple as using the Count() function and pointing it to a related field (usually the primary key of the child table).

Note that this calculation will be unstored by nature so it will recalculate its value every time you display the field.  Which is ok for small databases but can quickly become a performance hit if there are many related records or you want to use that calculated filed in a report with many parent records.

  • Author

Hi Wim,

Thanks for the advice.

I am developing a small inventory system to monitor movements of stocks. 

When we do goods receiving, there are multiple item code inside a Goods receive form. From the main inventory screen, the items that has related records match it will be displayed in the portal. 
 

For example in inventory, item EGG. 

In the goods receive form, I got multiple items scanned from barcode. There will be multiple line items of egg scanned which we receive 3 times. At the inventory screen will show 3 lines related to it. So I want to count that related 3 lines only without the rest of the items.


Thanks a lot.

An inventory system is a prime example of a system that will become gradually slower over time if you depend on calculated fields for totals.  As the number of in/outs grows over time and use unstored calcs for things like Qty-on-hand and other such items, you will get degraded performance as the system grows..

It definitely is something to consider based on what you know of how much data the system will need to deal with as time goes by.  Design choices you make now can have a serious adverse effect later.

One way to counter that is to make the process that scans the item update the count field on the parent with each scan (or when the user indicates that are done scanning).  That way the count field will be just a static number field.  Post back if you have any questions about this.

  • Author

Thanks

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.