On Feb 18, 2009, at 4:50 AM, Rob Russell wrote:
On Wed, Feb 18, 2009 at 12:19 PM, Mikhail Edoshin
<[email protected]> wrote:
BTW, as far as I know all FileMaker data keep a tag that describes
their type.
Mikhail,
Why do you think that? I've never seen evidence of it.
Hi Rob,
Probably because of the way it does date math. E.g. if a date field
My Date stores what looks like “2/18/2009”, then My Date + 1 =
2/19/2009; but if a text field My Text stores “2/18/2009”, then My
Text + 1 = 2182010. And this behavior does not change when I use the
field indirectly, e.g. via a custom function or a variable.
In most cases they also automatically convert into one another
depending on the context (e.g. A + B will convert values to
numbers, while A & B will convert them to texts), but sometimes
you'll need to guide these convertors with GetAs() functions.
As far as I know, the parameters are ALWAYS text, until you use
them, at which point FileMaker makes a decision about type.
Not quite, I think. I agree, what is stored in fields is always text
at some low level, likely because the idea was to respect and never
change original input. (Actually, I believe there are minor
exceptions to this rule and sometimes FileMaker slightly modifies
what was entered, but I don't remember exactly.) But all fields have
type and that type is like a hidden tag that describes how to
interpret this value. (What the GetAs() functions probably do is that
they ignore the tag and re-interpret the original value.) All
calculations, function parameters and script variables operate with
such tagged values; the only exception to this are script parameters
and results, which are flat strings.
For example, I have some custom functions that work with containers;
they pick pictures from a global variable and insert them into
repetitions of another global variable. (Later these pictures are
displayed as a calendar grid by a global calculation.) These pictures
don't even have text representation because they were copied and
pasted. But the mechanics works just fine.
However, this is often problematic if your parameter(s) is (are)
date(s) - (dates and FileMaker, always a barrel of fun) and you try
to perform some function on them such as date addition without co-
ercing the type.
Rob
Mikhail Edoshin
[email protected]