A system constant is a value that developers place in a custom function that then becomes permanent. It doesn "evaporate" at the end of a session (as global field values and global variables do), nor does its value vary from user to user. Developers can count on them being persistent and can easily edit them as needed.
We find it valuable to track version numbers of our systems and at times need to use logical (script) routines that reference or make use of those version numbers. Rather than adding a field to the data schema of a solution, use a custom function.
We recommend also creating a similar fnSolutionNamespace() function.
In all cases, fnSolutionVersion returns 1.003. Developers will want to update the hard-coded value as appropriate.
// returns version of database solution and name // input: none // output: version number or text 1.003 /*version history ...etc...
FileMaker uses a pilcrow character ("¶") to represent carriage returns but theres no analog for tab characters. This custom function is simple but vital if you need to do formatting with tab characters. The alternative is seeing blank space within your formulas and being left to wonder what is in the space: Space characters? Tabs? Odd characters that can display?
Note that Ctrl-tab inserts a tab character on Windows and Opt-tab on the Mac OS. The two are cross-platform compatible.
// tab character " "
With this function you can save yourself a bit of hassle by allowing the use of familiar terms for colors, rather than being forced to look up RGB numbers, but the real value here is in making use of the central nature of custom functions: If ever you need to change a color in your system you have one single place to do so. Tweak one of the RGB numbers in the function and your database will reflect that change throughout (however, some calculation results may be indexed). This custom function also ensures consistency. By virtue of having only one instance of a color, you never get confused on which red you e using in a given system.
fnTextColor ( "hello world"; "blue" ) returns "hello world" as blue text.
fnTextColor ( "hello world"; "purple" ) returns "color not recognized".
// returns colored text // input: // text = text string // color = keywords defined below // output: // text (w/color) Let ([ rgbValue = Case ( color = "red"; RGB ( 255; 0; 0 ); color = "green"; RGB ( 0; 255; 0 ); color = "blue"; RGB ( 0; 0; 255 ); color = "soliant"; RGB ( 231; 188; 19 ); color = "ltgray"; RGB ( 170; 170; 170 ); color = "dkgray"; RGB ( 120; 120; 120 ); "color not recognized" ) ]; // end variables Case ( rgbValue = "color not recognized"; rgbValue; TextColor ( text; rgbValue ) ) )
: FileMaker Specifications
FileMaker 8 Product Line
Specifications and Storage Limits
Field Types and Import/Export Formats
: Calculation Functions
Working with Calculations Primer
: Custom Functions
Custom Functions Primer
Useful Custom Functions
: Script Steps
Script Step Reference
: Quick Reference
FileMaker Error Codes
FileMaker Keyboard Shortcuts
FileMaker Network Ports
FileMaker Server Command Line Reference
FileMaker XML Reference
: Other Resources
Where to Go for More Information