Skip 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.

Need a summery field for some records

Featured Replies

greetings,

FM12, Mac 10.8. Customers make payments using various methods. There is a field that categorizes the method, credit card payment category begins with "5-".. So there are two fields "payment_amount" and "pay_type" which exist in the daughter table for payments and charges. I would like to have a summary field for credit card payments only. How to do that? Thank you.

Do you want a summary field for/from a report within the child table, or a sum calculation in the parent table?

  • Author

Do you want a summary field for/from a report within the child table, or a sum calculation in the parent table?

 

 

Do you want a summary field for/from a report within the child table, or a sum calculation in the parent table?

 

Hmm... sum calculation in the parent table. 

There are several time-honored ways to do this in FileMaker, but since you have FM12, you can use ExecuteSQL. That does away with the schema clutter necessary for those ancient methods.

 

In your Customers table, define a new calculation field and try this expression:

 

ExecuteSQL
  ("
  SELECT SUM ( yourAmountField )
  FROM aTransactionTO
  WHERE
     yourCustomerForeignKey = ? AND
     paymentCategory LIKE '5-%'
  " ; "" ; "" ; aCustomerTO::yourCustomerPrimaryKey // for some reason worked for me only when using a fully-qualified field name

)
 
If this is all Greek to you (sure looks like sort of Latin to me), take a peek into the sample file to see it in action. It has some added flexibility in that the payment type has been parametrized, too, so you can choose which payment type to sum.

SUMbySQL_eos.fmp12.zip

  • Author

WOW! Thank you very, very much. I believe I can adopt this into my FM solution. Frankly, I think I can adopt this general idea to a couple of other things, come to think of it. Thanks for the code, file, and the education. 

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.