Brian Dunning's FileMaker Custom Functions

GetFieldList ( fieldName ; recordNumStart ; recordNumEnd )

Gets a Range of field values for local or related field

  Average rating: 4.3 (34 votes) Log in to vote

Don Wieland   Don Wieland
DW Data Concepts
http://www.dwdataconcepts.com

Share on Facebook Share on Twitter

  Sample input:
GetFieldList (Color , 1, 3)

when a field called color has these values:

Record 1 = Blue

Record 2 = Yellow

Record 3 = Blue

Record 4 = Red
  Sample output:
Blue
Yellow
Blue

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Gets a Range of field values for local or related field. Returns a hard return delineated list.

Duplicates will NOT be omited. The equililent to a TextSum that some FMP plug-ins offer.

 

Comments

Christian   Christian, Minneapolis
Feb 17, 2011
Don,
This function does not seem to behave as expected if the last field in the found set is null.

For example, in a found set of 10 records, the "Nothing" field is all Null values. I would expect to have this

Valuecount(getfieldlist(Table::Nothing, 1, get(foundcount)))

to return "10" (for the the ten null values).

Instead this returns 9.

In fact, I've had some issues with this if ONLY the last field is Null.

Any ideas?

- Christian
 
Thomas Seidler   Thomas Seidler, London
Jul 4, 2013
Didn't want to create new function entry, as this is basically the same. I use this all the time, but I only ever use it to obtain complete lists of all field values (including blank) for foundset. It will be a value list of the exact length of the foundset (carriage returns within values will have been escaped). And I use it for really large foundsets. So I switched it to tailend recursion to enable up to 50k, and created a handler function:

GetFieldList ( fieldName )
=======
// Usage: GetFieldList ( Table::FieldName ) or GetFieldList ( GetField("Table::FieldName" ) )

GetFieldList_part ( fieldName ; 1 ; Get ( FoundCount ) ; "" )
=======


The sub-function:

GetFieldList_part ( _fieldName ; _start ; _end ; _valueList )
=======
// Switched to tail end, 2012, Thomas Seidler - to allow 50k

Let (
_thisVal = Substitute( GetNthRecord ( _fieldName ; _start ) ; "¶"; "\¶" ) ;

If (
_start < _end ;
GetFieldList_part ( _fieldName ; _start + 1 ; _end ; _valueList & _thisVal & "¶" ) ;
_valueList & _thisVal & If(IsEmpty(_thisVal);"¶")
)

)
 

Log in to post comments.

 

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

Under construction. Email me your wish list for improvements.