[FX.php List] FX and Editing Global Fields

Tim 'Webko' Booth tim at nicheit.com.au
Mon Nov 15 18:26:19 MST 2010


Dear Bradley,

> 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?

Example: Hosted file with Global_g set to a value of 1 (the value that  
was used in setting up the file, which will then be the default value  
for a hosted file)

In FileMaker, I login and change it to 2. It will retain that value  
until I logoff. Next time I login, it will be back at 1

Through php / XML, I make a request. The webuser / webpassword are  
passed as part of this, log me in, and the field will be have the  
value 1

I make a request that changes the value to 2 - the system logs me in,  
the value is 1, and gets changed to 2

I make another request referencing that field. The system logs me in  
and the value will once again be 1, the default value

The only time I can think of that will work is a single request that  
sets the field and then triggers a script that references the field.  
In that circumstance, you will be logged in, the field will be at  
defult of 1, the setGlobal changes it to 2 and then the script runs in  
the same request and references the value as 2.

Needless to say, the very next request will see the field back at its  
default value of 1, as the webuser is logged in again....


However I will say that in over 50 web based projects to date, I have  
never *needed* to use a global - so, if you tell us what you're trying  
to do, there is probably another way...

Cheers

Webko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20101116/b50a8ea8/attachment.html


More information about the FX.php_List mailing list