Brian Dunning's FileMaker Custom Functions

GetMajorVersion ( string )

Returns Major application version number (as string) by filtering out all non-numeric characters from version string and casting version float to an integer.

  Average rating: 5.0 (1 vote) Log in to vote

Julio Toledo   Julio Toledo - Show more from this author
Automation USA LLC
https://www.automationusa.net

Share on Facebook Share on Twitter

  Sample input:
GetMajorVersion ( $$MODULE.VERSION )
GetMajorVersion ( GetSystemPlatformVersion )
GetMajorVersion ( Get ( FileName ) )
GetMajorVersion ( Get ( WindowName ) )
  Sample output:
returns "1" when $$MODULE.VERSION = "Version 1.0.1"
returns "10" when GetSystemPlatformVersion = "macOS 10.14.2"
returns "0" when Get ( FileName ) = "My_App_0-0-3-5"
returns "1" when window name = "My_App_1_0_3"

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This custom function is intended to evaluate file names, server application version, API versions, global variables, window names, or any other string you throw at it and return the Major application version number (as string).

Accepts a single string as parameter. Defaults to "Get ( ApplicationVersion )" function.

Normalizes various non-normal methods of semantic versioning ( https://semver.org ), including use of non-standard separators such as underscore "_", hyphen "-", and comma ","

Examples:
GetMajorVersion ( "" )
returns "17" when Get ( ApplicationVersion ) = "ProAdvanced 17.0.3"

GetMajorVersion ( Get ( HostApplicationVersion ) )
returns "16" when Get ( HostApplicationVersion ) = "Server 16.0.4"

GetMajorVersion ( $$MODULE.VERSION )
returns "1" when $$MODULE.VERSION = "Version 1.0.1"

GetMajorVersion ( Get ( WindowName ) )
returns "1" when window name = "My_App_1_0_3"

GetMajorVersion ( GetSystemPlatformVersion )
returns "10" when GetSystemPlatformVersion = "macOS 10.14.2"

GetMajorVersion ( Get ( FileName ) )
returns "0" when Get ( FileName ) = "My_App_0-0-3-5"

GetMajorVersion ( Get ( FileName ) )
returns "2" when Get ( FileName ) = "My-App-2,1,3,5"

Returns "N/A" as default

 

Comments

Fabrice Nordmann   Fabrice Nordmann, 1-more-thing
Jan 6, 2019
Won't work on a file that uses coma as a decimal separator.
And there are some: http://alturl.com/k5sct
 
Julio Toledo   Julio Toledo, Automation USA LLC
Jan 6, 2019
Hi Fabrice,

Yes, Ibrahim Bittar posted the "Number, Date and Time formatting" proposal (of which you are a contributor) to a discussion on the community.

I've been replying to that and agree that these kind of localization challenges form a global issue that should be addressed at a deeper level than the calculation engine, ideally by the folks at FMI and not us developers.

Though I have not tested it on such a file, I just tested the string "ProAdvanced 17,0,3" on a US English file and it returned "17"). Having said that, if you have logic that can improve upon this function to address the issue you've observed, then by all means feel free to contribute.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: