How to recognize iPad and iPhone in FileMaker


10. February 2021In FM Starter, TipsBy Karsten Risseeuw1 Minutes

If you create a file for iOS devices, you probably have to be able to distinguish between iPhone and iPad. When starting the file, you need to create a query, based on which a layout for iPhone or iPad will be navigated. This should be possible with the status query:

Get ( ApplicationVersion )

If the file runs on the iPhone, the result is “Go”, while on the iPad it returns the result “Go_iPad”. A complete query can be created as follows, according to FileMaker Help:

Patterncount ( Get ( ApplicationVersion ) ; “Go” ) for iPhone, and
Patterncount ( Get ( ApplicationVersion ) ; “Go_iPad” ) for iPad

If one implements this query, it becomes apparent that this does not work well. Both requests recognize an iPhone. This does not change even if you only enter “iPad” for pattern recognition instead of “Go_iPad”.

A simple solution is to search only for iOS and then explicitly query the device:

Get ( Device ) = 4, for iPhone
Get ( Device ) = 3, for iPad

This works flawlessly.

Adjustment for FM Starter

The next update of FM Starter will include this for the navigation. If you want to adjust this already today, you have to do this here:

Script: GN GetSystemLayout, line 25.

Let (
a = Get ( ApplicationVersion ) ;

Case (
PatternCount ( a ; “Pro” ) ; 1 ;
Get ( Device ) = 4 ; 2 ;
Get ( Device ) = 3 ; 3 ;
PatternCount ( a ; “Web” ) ; 4 ;
1 )
)