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.

Counting Value List instances

Featured Replies

I'm sure this is simple, but it seems I haven't had enough coffee to see it....

On the main layout of a report form I have a Value List named TimeOfIncident for various school time periods-- value list values are Period 1, Period 2, etc.

On a report layout I want to have a listing of how many records there are for each time period; I have a field defined for each period called Period1Count, Period2Count, etc. The report would show

  • Period 1: 7 records
    Period 2: 2 records
    ...etc...

- where the number shown is the value of Period1Count, etc.

In English, the value of Period1Count equals the number of records where TimeOfIncident = "Period 1"

But for the life of me, I can't figure out how translate this into a FM calculation; have been trying to set the values by Calculation in Define Fields, but w/o success. Calculations can't do Finds, so how do I find value matches?

There are two common methods for counting values in a field: Summary reports and counting related values. Here's a look at each:

1. Summary reports

Add a summary field to the table where the TimeOfIncident field resides:

Count of TimeOfIncident (summary) = Count of TimeOfIncident

Then on a layout based on this table, add a Sub-Summary by TimeOfIncident part, and insert the TimeOfIncident field and the Count of TimeOfIncident field. When the records are sorted by TimeOfIncident and viewed in Preview Mode or Printed, the part will show with the counts for each period.

2. Counting related values

This is usually used if the counts must be viewed while in Browse Mode. It requires a relationship for each possible value of TimeOfIncident that you want to see simultaneously (or one relationship to a separate table where each TimeOfIncident is a separate record.) How the relationships work depends on your structure.

For the typical case of a Class-Section table (where each record is one particular period for a particular class,) relating to an Enrollment table (where each record is one Student's enrollment in a particular Class-Section,) the count is a simple calc field residing in the Class-Section table:

Count of Enrollments (calculation, number result) = Count(Enrollment::StudentID)

These could then be viewed in a list view, showing the enrollment counts in a list view, along with specifics about the Class and Section.

If you have a different structure, or need more, let us know specifics of how your tables relate, and what you need.

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.