KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Passing custom functions as parameters
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: August 14, 2002

Compatibility: 6.7.x and 6.8.x
Platform: Mac & Win

Custom functions can be passed as parameters in order to return parameter values.

When coding 4D, one starts out by doing a direct assignment of values as parameters:
ORDER BY([Table];[Table]Field;>)

Soon, one begins to write generic code passing values contained in variables:
ORDER BY($pTable->;$pField->;>)


Another aspect of writing generic code that is not so readily apparent is the option of passing custom functions to return parameter values. Here is the ORDER BY command using a custom function, Shell_PointerToTableForField, to return a pointer to a table:
ORDER BY(Shell_PointerToTableForField ($pFieldToOrderBy)->;$ pFieldToOrderBy ->;>)


Note:
The Shell_PointerToTableForField method is explained and its code is shown in the tech tip titled "Deriving a table name from a field pointer" composed on 8/2/02.