GetAsText ( “” )

It would be nice for some clarity here. My mental model is that FileMaker will store anything in any field (which is both handy, and kind of terrifying from a computer science perspective) but that if you want a "clean" version of the data, you can use the "GetAsX()" functions,

However, that appears to be wrong: this assumes "GetAsDate()" would return you a valid date object, in the "proper" format, but as experienced here: Partially Valid Dates that's clearly not how it works.

As an example, here's a quiz.
Run this in the Data Viewer/Watch panel. Before you do, predict what each line will give you.

GetAsNumber("1 - 7") & "¶" &
GetAsNumber("x df 0. ___ & * 0.   0.  0    7") & "¶" &
GetAsNumber("serial000001") & "¶" &
GetAsText("serial000001") & "¶" &
GetAsDate("09/11/2001")  & "¶"  &
GetAsDate("09.11.2001")  & "¶"  &
GetAsDate("09;11;2001")  & "¶"  &
GetAsDate("09_11_2001")  & "¶"  &
GetAsDate("09 11 2001")  & "¶"  &
GetAsDate("2001 09 11")  & "¶"  &
GetAsBoolean ( "" ) &  "¶"  &
GetAsboolean ( "foobar") &  "¶"  &
GetAsboolean ( "1foobar") &  "¶"  &
GetAsboolean ( "foobar1") 

Some of the results are rather surprising.

4 Likes