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.

building a report layout calc field?

Featured Replies

  • Newbies

I have this report layout built for one of the Doctor's I work for but I am stuck.

Most of the report fields are averages but for margin% field he wants a percentage from margin field. The margin field data is either a 0 or a 1. I thought this would be simple enough.

I want a total of all the records in the database.

Then add up all the 1's in the margin field.

Divide the record count by total of 1's in the margin field to populate the margin% field.

This sounds simple but I rarely have to do a calc of this nature and it is making me crazy. Am I making this harder than it should be?

Any advice appreciated. I am still trudging through the fmpro help files.

The margin field data is either a 0 or a 1.

I want a total of all the records in the database.

Then add up all the 1's in the margin field.

Divide the record count by total of 1's in the margin field to populate the margin% field.

Lets assume your Table is called "Data" for the sake of this example.

Create a calc field called "Rec1" that just contains a 1.

In the relationships graph duplicate your Data TO and call the second TO "Data Self"

create a relationship from one TO to the other using the Rec1 field.

Now create a calculation field called "MarginPrcnt" containing:

get(totalrecordcount) / sum(Data Self::Margin)

How about a summary field defined as average of Margin?

  • Author
  • Newbies

Thanks guys it took me a while to figure it out and your comments helped greatly.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

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.