AnsweredAssumed Answered

Reseting Served File Global Defaults

Question asked by coherentkris on Sep 26, 2014
Latest reply on Sep 26, 2014 by wimdecorte

I have been researching how to reset global field defaults when a file is served.

I understand that the file retains the value in the global field when the file was last opened locally.

I understand that running any kind of scripted action on the globals when the file is served only changes the values for my session.

I understand that the best way to reset the defaults is to open the applicable file locally and manually change the value.

I have been able to find two post from reputable developers (Mr Robertson and Mr Jondreau) that suggest the defaults can be reset via server side script.

 

http://comments.gmane.org/gmane.comp.db.filemaker.devel/35414

 

http://fmforums.com/forum/topic/87308-globals-reverting-on-server/

 

I have attempted this and the defaults were NOT reset.

The server side script was assigned to run with a full access permission set and did not return any errors.

Any ideas?

 

The script is:

 

Set Variable [ $fields ; Value:ExecuteSQL ( "SELECT TableName , FieldName FROM FileMaker_Fields WHERE TableName =?" ; "" ; "" ;

"ENV_GLOBALS" ) ]

Set Variable [ $max; Value:ValueCount ( $fields ) ]

Loop

Set Variable [ $counter ; Value:$counter + 1 ]

Exit Loop If [ $counter > $max ]

Set Variable [ $the_value ; Value:Substitute ( GetValue ( $fields ; $counter ) ; "," ; "¶" ) ]

Set Variable [ $the_field_prefix ; Value:Left ( GetValue ( $the_value ; 2 ) ; 2 ) ]

Set Variable [ $the_field ; Value:Substitute ( $the_value ; "¶" ; "::" ) ]

If [ $the_field_prefix = "__" or $the_field_prefix = "zz" ]

#do nothing to these fields

Else

Set Field By Name [ $the_field; "" ]

End If

End Loop

Outcomes