Function overview
Prototype
related.countIf (
relatedField; test; dataType )
Parameters
relatedField The related field you would like to perform the test on
test A test to be evaluated. All strings should be quoted
dataType Your value data type (one of number, text or date)
Description
Tags:
Simulation Related List Excel CountIf Count
Counts the number of related records that match a given criteria.
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".
Note: When evaluating against strings, you must remember to quote the strings, e.g. realted.countIf ( Related::Field ; "value = \"Fail\" OR value = \"UG\"" ; "text" )
Examples
Sample input
realted.countIf ( Assignment_Marks::percentage ; "value >= 70 AND value < 80" ; "number" )
Sample output
6 (returned where 6 of the records in the percentage field in the Assignment_Marks table occurance have a score between 70 and 80)
Function code
ValueCount( list.filter( List(relatedField) ; test ; dataType ) )
// ===================================
/*
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/199
Prototype: related.countIf( relatedField; test; dataType )
Function Author: Genx (http://www.fmfunctions.com/mid/29)
Last updated: 28 February 2009
Version: 1.2
*/
// ===================================
ValueCount( list.filter( List(relatedField) ; test ; dataType ) )__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/199__LITBR____LITBR__ Prototype: related.countIf( relatedField; test; dataType )__LITBR__ Function Author: Genx (http://www.fmfunctions.com/mid/29)__LITBR__ Last updated: 28 February 2009__LITBR__ Version: 1.2__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.
Comments
24 March 2009
related.countIf (Field1;"abs(Field1)>0"; "number" )
I expect a result of total number of records that meat the criteria, but the output is always "1" when criteria meets.
Did I do anything wrong in my input? or this function has to be used to count Fields in other related table? Is there a way to count Fields in current table?
Thanks!
25 March 2009
25 March 2009
Any suggestion?
27 March 2009
27 March 2009
http://picasaweb.google.com/jfxrsch/ScreenCaptures?feat=directlink
27 March 2009
27 March 2009
07 October 2009
I've have been having problems with this function. I think it is me being stupid, here is my problem.
I have a Field called "SAT 1" the only values allowed to be inputted are "E" and "L". I want to do a CountIF like in Excel that counts the number of records with "L" in the Field "SAT 1".
Is it possible with this function, if so how.
07 October 2009
It will work but only in a related context. Meaning if Sat 1 was a field in a related table occurrence (e.g. "Related") then you would do as follows:
realted.countIf ( Related::Sat 1 ; "value = \"L\"" ; "text" )