Re: Date object into FMP field
Re: Date object into FMP field
- Subject: Re: Date object into FMP field
- From: "Gary (Lists)" <email@hidden>
- Date: Thu, 11 Mar 2004 15:46:41 -0500
Andrew Oliver wrote [3/11/04 3:03 PM]:
>
What I said to do (and what I did in my case) was use AppleScript to build a
>
string containing the elements I wanted in the form "3 11 2004" which I put
>
into a Filemaker Text field.
Okay. Gotcha.
>
A calculation field in the same database parses out the three 'words' of
>
that string and populates a Filemaker Date
Not needed, and I suppose that's what confused me, with the LeftWords(),
RightWords() and so on.
Here's a simple example.
Tested - FM6.0v4 / AS 1.8.3
fDate is a field defined as type 'Date', it is not formatted on the layout
(i.e., 'Leave formatted as entered' is selected in Date Format... options
for that field)
[You can put the same field, just formatted however you want, on the same
layout, or you can even leave off the un-formatted version altogether and
reference Layout 0 when you set the value...either way...many options.]
-- // The script, with results along the way
set c to current date
-- date "Thursday, March 11, 2004 3:02:18 PM"
set cd to c as text
-- "Thursday, March 11, 2004 3:02:18 PM"
set wd to word 1 of cd
-- "Thursday"
set md to words 2 thru 3 of cd
-- {"March", "11"}
set m to item 1 of md
-- "March"
-- use your own routine to get month number
if m is "March" then set m to "3"
-- "3"
set d to item 2 of md
-- "11"
set y to word 4 of cd
-- "2004"
{y, m, d}
-- {"2004", "3", "11"}
set FMdate to m & "-" & d & "-" & y
-- or any other format you wish
-- "3-11-2004"
set cell "fDate" of current record to FMdate
-- // end
Nothing else is needed by FM.
--
Gary
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.