related.sumIf ( )

Function stats

Average user rating
5.0000
29
210
9999
Support
FileMaker 7.0 +
Date posted
28 February 2009
Last updated
08 March 2009
Version
Recursive function
No

Author Info
 Genx

18 functions

Average Rating 4.1

author_avatar



 

Function overview

Prototype

related.sumIf  ( relatedField;   test )


Parameters

relatedField  The related field you would like to perform the test on


test  A test to be evaluated.


Description

Tags:  SumIf   Sum   Simulation   Related   List   Excel  

Sums the values in relatedField where they meet a certain requirement.

See the required List.filter function for more information on the tests that can be performed.

If you want to use this in a version lower than 8.5, see the FM8List function as an alternative to "List".

Examples

Sample input

realted.sumIf ( Assignment_Marks::percentage ; "value >= 50 AND value < 100")


Sample output

The sum of all the values in Related::Field that have a value between 50 and 100.

 

Function code

List.Math( "sum" ; list.filter( List(relatedField) ; test ; "number" ) )

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/210

    Prototype: related.sumIf( relatedField; test )
    Function Author: Genx (http://www.fmfunctions.com/mid/29)
    Last updated: 08 March 2009
    Version: 1.2

*/
// ===================================

 

Comments

Delta Tango
09 March 2009



been looking for something like this for ages!!! thanks! i've always made a calculation field that display number if the criteria is met and then summed that in the related field.
  General comment
davehazle
21 January 2010



Hmmm, I am having trouble getting this function to perform as expected. Perhaps I am using it incorrectly. I am attempting to Sum Sales Dolars in a table for a specific week and display the output in a seperate table. It looks a bit like this for Week 1:
Related.SumIf ( Data_Metrics::SalesDolars; Data_Metrics::WK=1)
Can't seem to get it to behave, any advice?
  General comment