I have strong doubts that this kind of a conversion to get a TimeStamp as a number would work anyway.
btw, adding 0 to any number doesn't change the value at all.
I would assume that any manipulation of a Timestamp has to be set within the appropriate terms for 'Date', 'Time' OR 'Timestamp' (see Formula options on the right of the Formula Editor):
Timestamp ( Get ( CurrentDate ) ; Get ( CurrentTime ) )
Date ( month ; day ; year )
Time ( hours ; minutes ; seconds )
What is the purpose of this formula?
What is it you want to achieve?
please familiarize yourself with GetAsNumber
Excellent advice, FileKraft!
However, I want to point out that dates/timstamps in many DBs (not just FMP), the "NULL/empty" value or value of "0" may often be interpreted as the smallest possible value. For FM, that would be 1/1/001. I don't recall what it is with the various SQLs, but this "bug" has bitten me many times! Now I test for NULL in date, time and timestamp values.
GetAsNumber ( "" ) + 0 // result is 0 in data viewer
So, I think this is valid AFAIK an error if a field (or variable?) is used. Perhaps TS folks know.
or we use:
Case ( isempty ( mytimestamp ) ; 0
; GetAsNumber ( mytimestamp ) + 0
Definitely needing more research! Thanks for posting
Thank you for chiming in Beverly,
First regarding any kind of Algebra evaluation the GetAsNumber function results in empty string or numeric value - so independent of the functional dependencies the plus 0 should also result in a numeric value.
This is not the case.
What is the case here is that the result is falsely a timestamp.
GetAsNumer of a TimeStamp works fine and returns a filemaker integer value of seconds.
So if you apply the reverse function of a filemaker integer as in GetAsTimeStamp it works well.
The invariant of the expression is always true (except empty timestamps):
GetAsTimeStamp ( GetAsNumber ( MyTable::MyTimeStamp ) = MyTable::MyTimeStamp
Even shorter to explain the bug:
1. Create a timestamp field
2. Create a new record - timestamp field stays empty
3. Open Data Viewer and show GetAsNumber ( MyTable::MyTimeStamp ) which shows nothing which is correct
4. Change Data Viewer to GetAsNumber ( MyTable::MyTimeStamp ) + 0 and you get a TimeStamp result not a number.
So the bug is that a numeric result plus a 0 should be a numeric result and not a timestamp result.
What I am trying to do is fixing a even more severe bug where file settings are ignored and getNthRecord returns swapped month and day.
So how can I report this as a bug now?
FileKraft, you have posted to the proper place to report this as a Product Issue (bug or not).
Thanks for the finer details in what you are discovering.
I am aware this is the right place. I try to get these through to FM TS though since this is definitively a severe bug.
To make it more clear think about the semantics of "getAsNumber". It implies strongly the result is numeric.
What I showed is that this is not the case.
If you have any math or computer science background understanding the concept of a function to be side-effect-free you might agree and support my attempt of QA.
Here is my first issue report: Use System Formats not File Format gets mixed up function results of date fields
I am very interested in a better and more reliable product.
1 of 1 people found this helpful
Thank you for your post.
I am able to replicate the issue with FileMaker Pro 15 under both Mac OS X 10.11.5 and Windows 7. The issue also occurs with FileMaker Pro 14 under Mac OS X, but works as expected with FileMaker Pro 14 under Windows.
I have forwarded your posts along with a sample file and my findings to our Development and Testing departments for review. When I receive any feedback, I will let you know.
Testing is also able to replicate the issue. All information has been forwarded to Development for further review.