From Dwayne Wright - www.dwaynewright.com
In this example, we are sorting a portal by using a very easy technique with an obscure function introduced with FileMaker 5.5. If you try to use this example with a copy of FileMaker before 5.5, this example will not function.
The way it works is that you make a selection from the set of radio buttons First Name, Last Name, City, State or Area Code. Then you click the Sort It button and the portal complies. In many cases, you don’t have to click the Sort It button. That is because the Sort It button does not run a script. All it does is exit the record and allows the screen refresh option to update the portal.
We have two fields in this example, a global text field named Portal Sort. It is the field we have assigned the radio buttons / value list to. The second field is a calculated text field using the GetField function. It is also the field was are using as our sort setting in the Define Relationships dialog box. The field is named Portal Sort Calc and the calculation is GetField(Portal Sort).
Here is a refresher on the GetField function ... if you are unfamiliar with it.
New for 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?” It can return at least two different result based upon if you include quotation marks in the syntax of the field name. If you don’t use quotation marks, you get the information inside of that field. If you do use quotation marks, it looks at what is inside of that field, it the data inside the field equal the name of another field, it returns the contents of that field.
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.
Hopefully, you can see what we are doing. The GetField function returns the data inside of the field we specify with the radio button. The only thing we have to watch out for is mixed field types. An example would be a date field is being used when the GetField function returns a text result.
An example file can be downloaded at ...
http://www.dwaynewright.com/blogfiles/GetSorted.zip
=
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.