FileMaker’s GetField() function has always been struck me as a curious beast.  Every since it’s release back in Filemaker 5.5 or there abouts I had assumed that it returned the contents of the field specified by the parameter.  But there were a couple of cases where it didn’t work that way and I’d get fooled every once in while.  I didn’t quite understand what was going on.  I think I finally stumbled on an easy way to keep it straight.

In most cases, GetField(fieldName) seems to give you the value of whatever field is specified in the “fieldName” parameter.  For example if you have a field in “Contacts::firstName” with the name “todd” in the field, then  GetField(“Contacts::firstName”) would return “todd”.  But what if you used GetField() inside of GetNthRecord function? Like this:

GetNthRecord(GetField(“Contacts::firstName”); 2)

That actually does return the value from the “Contacts::firstName” field in record number 2. But how?  If GetField(“Contacts::firstName”) returns the contents of the field, then are function above should be equivalent to:

GetNthRecord(“todd”); 2)

Which would result in invalid calculation error. Clearly its not returning the contents of the field. So what is it returning? I think it’s returning the fully qualified reference to a field.  In this case, it’s returning:


The lack of quotes is not an oversight.  That’s how you would reference the “firstName” field in calculation.  If GetField() returns a reference then our GetNthRecord example  from above finally makes some sense.  It would reduce down to:

GetNthRecord(Contacts::firstName); 2)

Which would give us the correct result.  So in the case of GetNthRecord and in any other function that uses directly uses a field,  such as NPV, GetSummary, GetRepetition, GetFieldName or the aggregate functions, GetField() returns a reference not a value.

But what about in the more common use case where it seems to return a value?  I am guessing now, but I suspect that it actually returns a reference to the field first. Then, since in these cases the FileMaker calc engine is looking for an expression and not a field reference, it sees the reference as part of the expression and immediately evaluates it.  The effect is that you get the field’s contents.

Another possibility is the GetField is smart enough to know to return either a reference or a value depending on how it is used.  I can’t find a way to distinguish between these two interpretations.  But the model I propose seems simpler, and explains the behavior quite well.  So I am sticking with it for now. 🙂