Plug-ins > Outlook Manipulator

Outlook Timestamp


I am trying to write a script to update a Filemaker field if the the Outlook field has been updated.  I want to do this by comparing the Outlook "Modify" field with the timestamp for the Filemaker record.  However, I can't figure out how to compare the time stamps.  When I use the GetAsNumber function to convert the timestamps to integers, I get two different numbers.  From what I can figure out, the data from Outlook is not a true timestamp.  When I use getasnumber for June 17, 2009 11:18:00, I get 6172009111800 - if you look close it is just all the integers lined up.

How can I compare that with a filemaker timestamp?  I thought about parsing text, but it would get complicated quickly since it doesn't write 06, but just 6.  I am afraid for days it would just write 4 instead of 04.  Since I can't just count the first two, second tow, next four, etc.. and build a time stamp. When the first two digits are 11, is it Jan 1 or November?  If the first three digits are 121, is it Jan 21 (1/21) or Dec 1 (12/1).  I am confused what to do.

Anybody have a suggestion or can someone figure out an easy way to compare a Filemaker Timestamp field with the Outlook Modify field?

All values returned by the plug-in functions are text.  This means that any date, timestamp or number returned by a function is the textual representation of that date, timestamp or number.

I am guessing that you are trying something like GetAsNumber( PCEM_GetFieldData( "Modify") ).  The outer function (GetAsNumber) will treat the result of the inner function PCEM_GetFieldData as text instead of a timestamp.  Therefore it will not produce the desired results.

There are two ways to meet your goals, both involve changing the result of PCEM_GetFieldData from text to a timestamp.

1) Set a timestamp field to the result of the PCEM_GetFieldData function.  Then pass the contents of the field to the GetAsNumber function.  For instance:
#pseudo script - assumes that SomeTimestampField is defined as type Timestamp
Set Field[ Table::SomeTimestampField  ; PCEM_GetFieldData( "Modify" ) ]
Set Field[ Table::SomeNumberField ; GetAsNumber( Table::SomeTimestampField ) ]
#end pseudo script

2) Set the number field ( or variable) directly by adding another function to the calculation:
#pseudo script
Set Field[ Table::SomeNumberField ; GetAsNumber( GetAsTimestamp( PCEM_GetFieldData( "Modify" ))) ]
#end pseudo script

Let me know if this does not resolve the problems you are having

If I use the following function:

--- Quote from: Chris on June 25, 2009, 09:05:19 AM ---Set Field[ Table::Some TimeStampField  ; PCEM_GetFieldData( "Modify" ) ]

--- End quote ---
Then the result in "Table::Some TimeStampField" will be a questionmark: "?"
When i change the code to:

--- Code: ---Set Field[ Table::Some TimeStampField  ; GetAsText ( PCEM_GetFieldData( "Modify" ) ) ]
--- End code ---
then I get a correct result like for example: 25-09-2009 15:15:00

This problem may have something to do with the difference in date-notation between USA and Europe a date in Europe is represented in the form dd-MM-yyyy where in the USA the usual form is MM-dd-yyyy. Therefore when the day in the date is larger than 12 an illegal format of the the timestamp will be the result in case you have your system-formats set to "Dutch" or "German".

Another problem that occurs is when day in the timestamp is less or equal to 12 the date will be wrong: 01-07-2009 is Juli 1st 2009 in the Netherlands, January 7th 2009 in the USA.

In both cases the fix is to add GetAsText ( ) and the result will be reliable, the only problem you still have is how to automatically figure out which systemsettings (US or NL) are used ;)


[0] Message Index

Go to full version