See if a file is opened on server or local (FM Go)

Good morning soupers,

i´m trying to figure out a way to show an user if he is connected to the file on my server or if he is running the local .fmp12 file on his iPad. Do you have any ideas/tipps on how to do that?

Best regards

You can view the users connected to each file on your server in the Filemaker Server Admin console...

If I understand your question correctly, you want to notify the user of whether they are viewing a file on their local device or on a host (server): You could consider having a global field set with a script trigger on first window open to "Get ( HostName )". I always have a table of global fields for various tasks, so in my designs the field would in be my "Globals" table.

This field could be displayed on whatever layout suits your needs, or it could be used to define a custom dialog to notify the user of the situation. It could also be used to define the visibility of a graphic, etc.

Alternatively, use "Get (ConnectionState) which will return a "0" for local (on the current device) and "1" for connected to server host. Then act on that result accordingly.

2 Likes

I guess "Get (ConnectionState)" will solve my problem. I will test it soon, and report back

If you don't need to know which host one is connected to Get (ConnectionState) is useful.

Get(ConnectionState)

Returns a number representing the security state of the network connection for the current file.

Get(NetworkType)

In FileMaker Go, returns a number representing the type of network being used to access the current file. In FileMaker Go, returns:

0 if the current file is a local file on an iOS or iPadOS device

Connection State is about security on the line. It may do the job but the function Get(NetworkType) is a closer fit for this situation.

4 Likes

Good catch, Malcom. My error. I should’ve reviewed it instead relying on memory. Thanks.

I had done a quick “echo” of connection state here and it returned “0” and “1” as described. I should’ve reviewed the docs since I don’t use it often. HostName has been useful to me however.

Thank you both for your valuable input. It works as expected and solves my problem.

Looks like you got what you need. Just do add another evaluation, in case you need to build ‚if‘ conditions depending on current FM-Version:
Get (HostApplicationVersion)
would result in:
„Server 18.0.4“

1 Like