Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 9.0   9.1   9.2   9.3   9.4   9.5   10.0   10.1   10.2   10.3    Statistic  


Checks if plugin is running on a server.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Plugin 4.3 Yes Yes Yes Yes Yes
MBS( "IsServer" )   More




Returns 1 on server or 0 elsewhere.


Checks if plugin is running on a server.
So if you see 0 returned, your script or calculation is not performed on a server, but on a client.
Should return 1 always for scheduled server scripts or web direct scripts.

See also IsRegistered, IsClient and IsRuntime.


Run a script on server:

If [MBS("IsServer")]
    # We run on server already
    # Call this script on server
    Perform Script on Server [Wait for completion; “Your Script”; Parameter: Get(ScriptParameter)]
    If [Get(LastError)  ≠ 0]
        # Can't run on server, e.g. too many connections.
    End If
End If

Perform Script on Server:

# are we on Server?
If [MBS("IsServer") = 0]
    # perform same script on server and pass parameter
    Perform Script on Server [Wait for completion; “Do Something on Server”; Parameter: Get ( ScriptParameter )]
    # check error and result
    Set Variable [$LastError; Value:Get ( LastError )]
    # Maybe handle here error code if server is too busy and decide what to do, e.g. run script locally?
    If [$LastError ≠ 0]
        # run locally by fall through
        # alternative: Exit script here and return error to caller
        Set Variable [$ScriptResult; Value:Get ( ScriptResult )]
        #Return result back to caller
        Exit Script [Result: $ScriptResult]
    End If
End If
#This now performs on Server or on Client if Server is too busy
Go to Layout [“Test”]
New Record/Request
Set Field [perform::First; 1]
Set Field [perform::Last; 2]
Commit Records/Requests [No dialog]
# end of script

See also

Blog Entries

Created 18th August 2014, last changed 21st October 2017

IsRuntime   -   IsWindows

Feedback: Report problem or ask question.

MBS FileMaker Plugins