Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

FM9 incompatible step in calculation?

Featured Replies

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 by Justin Close

  • Author

Dang it.  Obviously didn't check that part.  :(

Thanks.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.