[FX.php List] FX and Editing Global Fields
Chris Hansen
chris at iViking.org
Tue Nov 16 08:53:15 MST 2010
Bradley (and all),
Sorry about the confusion. I have this personality quirk where I explain some things TOO thoroughly and other times I miss details. *sigh* FileMaker globals do work via FX.php (I'm using them in a project right now.) At any rate, the folks here are correct, globals are session specific, and do not persist between FX.php connections. Here's how things work:
1) When using FileMaker Server, any global value which is set in one session is not available in anyone else's session, regardless of the client type.
2) In the cases where a value persists for a single user, it is because FileMaker is tracking login and logout, and one of your limited sessions will be consumed until the user does log out. This is the case with FileMaker Pro, IWP, and XSLT using sessions. There is no option to use FileMaker sessions with XML.
3) Even if FileMaker sessions could be used with XML CWP, my opinion is that PHP sessions would be superior because: (1) PHP is generally much faster than FileMaker; and (2) PHP has no 100 simultaneous sessions limit.
4) In the event that I need a value which is common to all sessions, I use a one record table (as I'm sure others here do as well.)
So, to ask the question that others here have, what are you trying to accomplish? There's definitely a way to do what you need to do, though it may not be what you'd assume =)
Okay, now as to documentation, Gjermund has mentioned here that he has been putting some development versions of FX.php up on the sourceforge site for FX.php (yes, there is one, and it's been around almost as long as FX, though it hasn't been used much.) I'll have a wiki of some sort going by Christmas, as well. (Please hold me to this, folks =) Basically, I realize that at this point, we've come a long ways, and there are a number of you that could make really solid contributions both in terms of development and documentation. Additionally, FileMaker Web development is more mainstream than it was when FX.php first appeared. This list is awesome, but people need better documentation than what I've done, and it won't hurt to have someone checking my facts, too =)
Best,
--Chris
On Nov 15, 2010, at 5:55 PM, Bradley Creamer wrote:
> Hi Karstyn,
>
> Here's the instruction set from the "Function Reference for FX.php":
>
> SetFMGlobal ($globalFieldName, $globalFieldValue)
> This function is FileMaker 7 specific and is equivalent to appending ".global" to a field name in order
> to set a global field. In order to ensure that a global is set in FIleMaker 7 (before performing a script,
> for example), use this function instead of AddDBParam() to set the global field.
>
> >> The $globalFieldName parameter should contain the name of the FileMaker global field to be
> set.
>
> >> The value passed via $globalFieldValue will be stored in the specified global field before other
> FileMaker actions are performed.
>
> That's all I can find. So, my expectations of this function is to "set" the global field permanently regardless of session. I know that FMP11 handles things much differently than FMP6, but why would the DB reset the value of a global field when it's asked so specifically change that value?
>
> Regardless of my intent, where does it say globals are set on a per-session only, then revert?
>
> I did find this from FileMaker's CWP documentation:
>
>
> For direct XML requests and requests made via XSLT stylesheets that don’t use sessions, the global values expire immediately after the request is made. For requests made via an XSLT stylesheet that use sessions, the global values persist for the duration of the session defined in the stylesheet, or until they are changed again with another request.
>
> I seriously don't understand this behavior. Does anyone know of a work-around that makes the NEW global field value persist using XML?
>
> Thanks,
> Bradley
>
>
> On 11/15/2010 4:41 PM, Karstyn McCoy wrote:
>> Hi Bradley,
>>
>> Just to expand on this a bit, PHP can pull data from a global field, but it will default to the value that was stored while the database was last opened in single user mode.
>>
>> Remember that global fields are user session specific, so they can behave much different from the web then they may from a FM client. As Tim just mentioned the value may be set correctly, but each new PHP query starts a new user session, so you will not get the last value you set.
>>
>> It may help to know the broader issue you are trying to solve.
>>
>>
>> --Karstyn
>>
>>
>> On Mon, Nov 15, 2010 at 4:32 PM, Tim 'Webko' Booth <tim at nicheit.com.au> wrote:
>>
>> On 16/11/2010, at 11:25 AM, Bradley Creamer wrote:
>>
>>> Hi Chris,
>>>
>>> I'm specifically asking you this question because I found your post at:
>>>
>>> http://filemaker.463488.n4.nabble.com/Set-Global-Field-in-FileMaker-from-PHP-td2324363.html
>>>
>>> ... where you say that FX works when editing a global field.
>>>
>>> I haven't been successful.
>>
>> How do you know that?
>>
>> It may well be edited, but the next request you make effectively re-logs the web user in (the web is stateless...) so that the global will be rest to default... at least, that is my understanding...
>>
>> Now, my question - what are you trying to use a global field to do?
>>
>> Cheers
>>
>> Webko
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>
> --
>
> ****************************************************
> De Anza Web Team / Technology Resources Group (TRG)
> webteam at deanza.edu
> ----------------------------------------------------
> Update Your Firefox Browser! (www.firefox.com)
> ****************************************************
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
More information about the FX.php_List
mailing list