BlogFileMaker

Named Constants in FileMaker

By May 20, 2019 May 30th, 2019 No Comments

In the FileMaker platform, there are a series of reserved words that have been covered before and are well documented. You can see a listing of those reserved words in the references section at the end of this post.

Lesser known are the named constants that are part of those reserved words. In computer programming, a constant is a value that does not change and cannot be altered. When assigned an identifier, or name, the value can be referenced as a “named constant” interchangeably with the value itself.

Here is a table of the named constants used in FileMaker, and their associated value:

Constant Name Value
AllStyles 32767
Bold 256
CentralEurope 3
Condense 8192
Cyrillic 2
DoubleUnderline 128
Extend 16384
False 0
Greek 1
Higher 1
HighlightYellow 4096
Italic 512
JSONArray 4
JSONBoolean 5
JSONNull 6
JSONNumber 2
JSONObject 3
JSONRaw 0
JSONString 1
Lower 0
Lowercase 32
OEM 7
Other 10
Plain 0
Roman 0
ShiftJIS 4
SimplifiedChinese 6
SmallCaps 2
Strikethrough 1
Subscript 8
Superscript 4
Symbol 8
Titlecase 48
TraditionalChinese 5
True 1
Underline 1024
Uppercase 16
WordUnderline 64

Interestingly, the numbers used appear to be an 8-bit safe number sequence, which makes perfect sense in a programming language. You can see some interesting results using the Data Viewer if you have the Advanced Tools enabled in your copy of FileMaker Pro 17 or are running an Advanced version of FileMaker Pro by seeing the result of the following calculations:

Bold + Underline
result: 1,280

You could also use the value interchangeably such as in the JSON functions, for example:

JSONSetElement ( $json ; "name" ; "Mike" ; 1 )

is equivalent to writing:

JSONSetElement ( $json ; "name" ; "Mike" ; JSONString )

That being said, I do NOT recommend replacing the named constant with their corresponding value. While these are unlikely to change in future versions, as a matter of best practice I would always use the named constant, as recommended in the official documentation. I have occasionally seen, especially in the case of JSON functions, values used in place of their named constant.

Using named constants makes programming code self-evident as well as easier to understand and read. Rather than memorizing an obscure set of numbers, you can use names to reference what those numbers are.

References

Mike Duncan

Mike Duncan

Mike is an AWS Certified Solutions Architect as well as a certified FileMaker Developer. In addition to his work, Mike also enjoys pursuing his art, freelance writing, traveling, and spending time with his family.

Leave a Reply