Get Field Function For FileMaker Sorting Portals With Color

From Dwayne Wright PMP
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

Please Note: If you are viewing this page in a news feeder, the images may get munged up a bit. For the best experience, please visit the journal directly by clicking (here). 

THE GETFIELD FUNCTION GetField ( fieldName )
Introduced with version FileMaker 5.5, this is an odd little function. Kind of a “ is it a dessert topping, is  it a floor wax or is it both?”  The syntax for the function is ruthlessly simple, GETFIELD(name of field).   

The  GetField  function  can  return  at  least  two  different  results  based  upon  if  you  include  quotation  marks  in  the  syntax of  the  field  name.  If  you  use  quotation  marks,  you get  the  information  inside  of  the field.  If you don’t use  quotation  marks,  it  looks  at  what  is  inside  of  that  field.  If  the  data  inside  the  field you reference within the GetField parameter is equal to  the  name  of  another field, it returns the contents of that field for that record.  

Without quotes - value in the field

With quotes - name of the field

THE SETUP     
So let’s  say we have a field  called  “Variable”  and  currently it has  the text string  “First Name” in  that field. In that same file,  we also  have a field called “First Name”  and that  field contains the text string of “Dwayne.”

If we setup  the function  as  GetField(variable), the function  will  return the text string of  “First Name” as it’s result.  

If we setup the function  as GetField(“variable”), the function will return the text string of  “Dwayne” as it’s result. Given that my name is typed into that field for the record I’m on.

I know that the GetField function takes  a little getting used  to ... however ... it is a truly  fantastically  flexible  function.

AN EXAMPLE
This example uses the GetField Function Sorting example and expands on it. What we have done has allowed the sorted field to be highlighted in yellow. This is a very simple technique. First we created a container global field and pasted a color rectangle in the field. Then for each field in the portal, we created a duplicate calculation field that has a container result.

For example, we have a First Name Highlight field with the following calculation ...

If(Portal Sort = "First Name", Highlight Color Global, "")

which is to say that if the radio button equals First Name, show the color.

Like we said earlier, we created a highlight field for each field in the portal. The we put these fields in the portal behind the regular fields. This can be done with the options in layout layering.

An example file can be downloaded by clicking (here)
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2007 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.