Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

ConditionalSummary ( TypeField ; Type ; SumField )

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.5  (35 votes)
  Discuss this Custom Function

Koji Takeuchi, Splash, Inc.
http://www.splash.jp/

Sum a SumField for records where TypeField matches

Sample Input:
ConditionalSummary ( cat ; "a" ; num )
Sample Output:
30


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

ConditionalSummary ( TypeField ; Type ; SumField )
2011.07.13, Koji Takeuchi <takeuchi@nemoux.com>

description:
Sum a SumField for records where TypeField matches "Type" param.
Original concept by TypeSumField ( TypeField ; Type ; SumField ; Counter ) function by Bruce Robertson <http://www.briandunning.com/cf/894>, thanks Bruce and David.
This function is "no Counter param" version.
2012.03.13 Updated to solving a bug spotted out by Bruce Robertson. Thanks, Bruce.
ex1:
FoundCount = 3
record 1: cat = "a", num = 10
record 2: cat = "b", num = 5
record 3: cat = "a", num = 20
ConditionalSummary ( cat ; "a" ; num )
-> 30
ex2:
List ( child::cat ) = "a¶b¶a"
List ( child::num ) - "10¶5¶20"
ConditionalSummary ( child::cat ; "a" ; child::num )
-> 30

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

Discuss:

5 most recent comments | Show all 12 comments

Is it possible to modify this two have two conditions?

Michael, USA
May 29, 2014 8:19pm

Michael, You can do it.

1. Add TypeField2 param to this function and recursive call part in last "Case".
2. Modify "val" variable as following.

org:
val =
Case (
Type = "Total" or
Type = GetNthRecord ( TypeField ; $$ConditionalSummary_counter ) ;
GetNthRecord ( SumField ; $$ConditionalSummary_counter ) ;

0
)


OR version:
val =
Case (
Type = "Total" or
Type = GetNthRecord ( TypeField ; $$ConditionalSummary_counter ) or
Type = GetNthRecord ( TypeField2 ; $$ConditionalSummary_counter ) ;
GetNthRecord ( SumField ; $$ConditionalSummary_counter ) ;

0
)


AND version:
val =
Case (
Type = "Total" or
(
Type = GetNthRecord ( TypeField ; $$ConditionalSummary_counter ) and
Type = GetNthRecord ( TypeField2 ; $$ConditionalSummary_counter )
) ;
GetNthRecord ( SumField ; $$ConditionalSummary_counter ) ;

0
)

Koji Takeuchi, Tokyo
May 29, 2014 11:03pm

Hello Koji,

For using the two variables I am not sure about 'recursive call part in last Case'.

Could you please post a custom function and post it here.

Thank you

Sam, san jose
July 08, 2014 9:13am

Hi,
I'm working with this function and it almost does what I need it to. It actually does what I want, but gives me a pop up saying that the "specified field cannot be found". The reason it says this is because, for the last last parameter, instead of inserting a field, I insert Count(field). Like I said, it gives me the right results in the viewer/watcher, but gives me that popup error message first. I don't know enough about Let statements to be able to modify it for myself. Basically if field A = cat, I need to count field B. So Something like

ConditionalCounter ( Field A; "cat"; Field B).

Can you help?

Renee, Naperville
April 08, 2015 9:10am

Thank you. A life saver

Aleksandar, Macedonia
January 29, 2016 3:58pm

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 9 + 3 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. decFromHex ( hexValue )
  (Mon, Oct 16, 12:34pm)
2. MonthYearList ( startmonth ; startyear ; numbermonth ; short )
  (Mon, Oct 16, 3:38am)
3. ErrorDescription ( errorNumber )
  (Wed, Sep 27, 2:51am)
4. decodeEntities (text)
  (Wed, Sep 27, 1:22am)
5. HexidecimalToNumber ( HexidecimalValue ; counter )
  (Mon, Sep 25, 12:39pm)
6. FixedFieldConverter ( Fieldname ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 ; f8 ; f9 ; f10 ; f11 ; f12 ; f13 ; f14 ; f15 ; f16 ; f17 ; f18 ; f1
  (Fri, Sep 15, 12:34pm)
7. ShannonEntropy ( text )
  (Thu, Sep 07, 5:59am)
8. LetterCount ( text ; summary )
  (Thu, Sep 07, 5:53am)

RSS Feed of Custom Functions