Justin Close Posted July 8, 2015 Posted July 8, 2015 (edited) I was doing a bit of work for a client who is running FM9 clients, connecting to a file hosted on an FM11 server. I don't have FM9, so was doing development on FM11. I thought I had checked out that everything was compatible, but I somehow generated a calculation that doesn't evaluate on 9, but does on 11. The components of the calculations and custom functions used all appear to be innocuous... I am hoping someone here knows what I tripped up on. Here's the field calculation, and the 2 custom function definitions that it uses. The entire point of this calculation is to take a mish-mash text field that they have and make it sort nicely. For this bit I added, I'm just concerning myself with sorting some suffix numbers that occur between parentheses, e.g. 12345(A-1). Field calculation definition: Let ( [ _fileNum = Files::File Number ; //Position of 1st open/close parens, and then extract the text between them: _sParen = Position ( _fileNum ; "(" ; 1 ; 1 ) + 1; _eParen = Position ( _fileNum ; ")" ; 1 ; 1 ) ; _suffix = Middle ( _fileNum ; _sParen ; _eParen - _sParen) ; //Count the leading digits before any non-digit character, e.g. an alpha, or dash or space, etc. _count = CountPrefixDigits ( _suffix ; 0 ) ; //Remove extraneous characters (dash, space): _suffix = Substitute ( _suffix; ["-";""]; [" " ; ""] ) ; //Pad out the string to min 5 characters (helps 75-A sort next to 75): _suffix = _suffix & Left ( "!!!!!" ; 5 - Length (_suffix) ); //Reverse the character sequence (so the Code() call works out better): _suffix = ReverseString ( _suffix ) ]; _count & Code ( _suffix ) //prepend the digit count, but don't encode that count, just the rest of it ) -------------------- 'CountPrefixDigits ( aString ; aCounter )' custom function: If ( IsEmpty ( GetAsNumber ( Left ( aString ; 1 ) ) ) ; aCounter ; CountPrefixDigits ( Right ( aString ; Length ( aString) - 1 ) ; aCounter + 1 ) ) -------------------- 'ReverseString (aString)' custom function: If ( Length ( aString ) > 0 ; ReverseString ( Right ( aString ; Length ( aString ) - 1 ) ) & Left ( aString ; 1 ) ; Left ( aString ; 1 ) ) Thanks, Justin Edited July 8, 2015 by Justin Close
Wim Decorte Posted July 8, 2015 Posted July 8, 2015 Code() is not available in FM9 http://www.filemaker.com/help/14/fmp/en/html/func_ref1.32.230.html 1
Justin Close Posted July 9, 2015 Author Posted July 9, 2015 Dang it. Obviously didn't check that part. Thanks. 1
Recommended Posts
This topic is 3692 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now