"Write FileMaker Source to Variable"/System Format

Support for our integrated Contact Manager, Calendar, and Project Tracker.
Posts: 17
Joined: Fri Apr 23, 2010 5:58 am
Location: Jackson's Point, ON
PostPosted: Fri Apr 23, 2010 8:05 am
I just started integrating SeedCode calendar into an existing database and have encountered an issue with the "Write FileMaker Source to Variable" script and my system's date format (yyyy/mm/dd).

It seems that FileMaker's Insert Calculated Result script step does not respect the user's System Formats, even if Use System Formats is turned on.

That is, this script would loop ad infinitum without error because the date fields were expecting dates in the system format but the Insert Calculated Result would force the date to mm/dd/yyyy or somesuch thing.

My workaround for this was to create a custom function: ObjectSource ( object ) = GetLayoutObjectAttribute ( object ; "source" ).

I replaced all Insert Calculated Result steps in this script with Set Field by Name, where the target field is ObjectSource ( {objectname} ) and the result is the same as the calculation in the Insert Calculated Result step.

For example, I replaced:

Code: Select all
Go to Object [Object Name: "SourceDateStart"]
Insert Calculated Result [ select ; $sc_DateRangeStartDate & "..." & $sc_DateRangeEndDate ]


with

Code: Select all
Set Field by Name [ObjectSource ("SourceDateStart"); $sc_DateRangeStartDate & "..." & $sc_DateRangeEndDate ]


I did a search for this issue on the forums and from the looks of it I'm the only one who's come across this issue. Or perhaps I've overlooked something somewhere else. In any case, I hope this helps someone in my situation.

For what it's worth, I'm running FileMaker 11 Advanced on OS X 10.5.


Peter
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Fri Apr 23, 2010 2:37 pm
Peter,

Thank you VERY much for posting this. Quite cool.

I'd like to think that the calendar would have worked for you without this mod: we are looking for YYY/MM/DD dates in the script "Check System formats" and this change our find requests in the first SetVariable lines of the script "Write FileMaker Source to Variable".

Was that not working for you? If you have any thoughts as to why I'd love to know.

Actually, once you paste these scripts into your file there should be no difference between the date formats used in the finds and the date formats used for your data. But this is tricky stuff to be sure. If you have any further thoughts I'd love to hear them.

Thanks again for your post.

- John
John Sindelar
SeedCode
Posts: 17
Joined: Fri Apr 23, 2010 5:58 am
Location: Jackson's Point, ON
PostPosted: Fri Apr 23, 2010 3:08 pm
John Sindelar wrote:Peter,

I'd like to think that the calendar would have worked for you without this mod: we are looking for YYY/MM/DD dates in the script "Check System formats" and this change our find requests in the first SetVariable lines of the script "Write FileMaker Source to Variable".

Was that not working for you? If you have any thoughts as to why I'd love to know.


My first attempts at fixing this was through editing the Check System Formats script which, by default, was clearing out the $$sc_SystemFormat variable because I had copied the layouts into my own file. I initially forced this script to retain that value since it was correctly figuring out my yyyy/mm/dd format.

However, and this is the strange part, "Write FileMaker Source to Variable" would insert the date in yyyy/dd/mm format. Totally unexpected, to say the least.

Now, since my original post I took another crack at the system in FileMaker 10 Advanced and there are no issues with the script honouring my System Format. I wonder if there's a subtle difference between 10 and 11.

I should note, too, that I originally integrated the calendar into my own system by keeping SeedCode open in FM 10 Advanced and dragging the layout elements into my own system in FM 11 Advanced. Given that your script does actually perform properly, I wonder if this method of integration introduced some sort of corruption. I noticed that some of the graphic elements didn't pull over properly using this method.

In other words, I suspect the error here was behind the keyboard, not in your code. :)


Peter
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Fri Apr 23, 2010 3:26 pm
Well there is a problem in copying from FM10 to FM11. Though I don't know if you've run into it. Yet. =(

The issue is that FM11 renamed a couple functions and since copying and pasting resolves based on the *name* of the function, not the ID. You can have problems. Specifically, Get ( PortalRowNumber ) in Fm10 is now Get ( ActivePortalRowNumber ) in 11.

The others, which don't apply here, are:

FileMaker Pro 10 FileMaker Pro 11
Get(PrivilegeSetName) Get(CurrentPrivilegeSetName)
Get(ExtendedPrivileges) Get(CurrentExtendedPrivileges)

Now, since my original post I took another crack at the system in FileMaker 10 Advanced and there are no issues with the script honouring my System Format. I wonder if there's a subtle difference between 10 and 11.


Well that is good to hear. I wonder what if it would work if you re-integrate using Fm11 to Fm11. But using the SetField mod you posted is great. Thanks again.
John Sindelar
SeedCode
Posts: 17
Joined: Fri Apr 23, 2010 5:58 am
Location: Jackson's Point, ON
PostPosted: Fri Apr 23, 2010 3:54 pm
John Sindelar wrote:I wonder what if it would work if you re-integrate using Fm11 to Fm11. But using the SetField mod you posted is great. Thanks again.


I will have an opportunity to try it; the work I did today was really a test-run of the integration on a backup copy. I'll do the real deal entirely in FM11. Thanks for the reminder re: function name changes; I'd forgotten about that and it didn't even occur to me. And regarding the Set Field mod, it's my pleasure to give a little something back. :)

Return to SeedCode Calendar

Who is online

Users browsing this forum: Google [Bot] and 4 guests

(855) SEEDCODE
[email protected]
Follow us: