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.4  (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.

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 2 + 9 =
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. HexUUIDToNum_cf (_uuid)
  (Sat, Jun 16, 1:55pm)
2. httpResponseCode ( responseHeaders )
  (Tue, Jun 12, 10:40pm)
3. FindDuplicateCharacters ( string )
  (Fri, Jun 08, 5:01pm)
4. FieldRepetitionLast ( field ; maxRepetition )
  (Wed, Jun 06, 6:05pm)
5. CountModifiedRecords ( NameTimestampField ; StartTimestamp ; EndTimestamp )
  (Mon, May 28, 8:23am)
6. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
7. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)
8. @JSONFormatElements ( json )
  (Tue, May 15, 3:31am)

RSS Feed of Custom Functions