richardbabley Posted July 16, 2012 Share Posted July 16, 2012 Hello, I've set up a script to sort records in a Health and Safety Database, but two of my fields are in number format, while the rest are text. My Serial Number fields is sorting like 1, 11, 12, 2. I want it to sort numerically like 1, 2, 11, 12. How do I fix this? Thank you! Richard H&S Database Test.fmp12 2.zip Link to comment Share on other sites More sharing options...
eos Posted July 16, 2012 Share Posted July 16, 2012 Try this for the Sort List Key calc - and make sure the popup selection field is Sort Selection, not Sort List Key. Also, you should check the options for the Serial Number. Let ( [ theSortField = GetField ( Sort Selection ) ; theSortName = GetFieldName ( theSortField ) ; fieldTypeIsNumber = PatternCount ( FieldType ( Get ( FileName ) ; theSortName ) ; "number" ) ] ; Case ( fieldTypeIsNumber ; Right ( "00000000" & theSortField ; 9 ) ; theSortField ) ) Will work till your billionth record! Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 4326 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