RodinBangkok Posted March 13, 2003 Posted March 13, 2003 Just had an interesting problem. I had the need to find the "max" of an alphabet character, one per record, related to its associated part number. Background... this new customer uses letters for Revision levels of his drawings. A is first B second, and so on. We need to know the current release of any drawing (highest letter in alphabetic order), so we need to find essentially the "max" of the rev level field in alphabetic sequence and have that available to all part numbers in the file... Now having said that I accomplished it already by using a huge case file converting the letter to number then using the obvious methods, max number, etc to get to the solution, then once there converting it back to text, not an elegant solution, but works and I can get the data to other related files simply based on the part number. So on to my question, anybody have a simple calc to sort by alphabetic sequence without third part ascii conversion mod's, seems to me there must be a better way than brute force Case conversion, or am I expectting too much from FMP.
djgogi Posted March 13, 2003 Posted March 13, 2003 Check the attachment. I think it suits your needs. Dj OK, so attach file doesn't work. It's easy to implent it. Supposing you have some field that identfy drawings form same serie like squence or whatever, define an self relationship "SelfRel"on this field. Set sort order (sort related records option) for this relationship on your field of interest and make it descending. Finally define field maxtext=SelfRel::yourTextField or if you prefer to have ID of record maxTextID=SelfRel::ID wher ID is unique identifier of the record.
LiveOak Posted March 13, 2003 Posted March 13, 2003 A simple way to turn a rev. letter into a number is: RevNum (calculation, number) = Position("-ABCDEFGHIJKLMNOPQRSTUVWXYZ", RevLtr) Leave out any letters you don't use (I & O perhaps). I'm assuming an unrevised drawing is a "-" revision. -bd
djgogi Posted March 14, 2003 Posted March 14, 2003 Reposting the attachment. The formula Brent gave you is ideal if you need to convert 1 letter. So if that is your situation, I'll recommend it instead of relational solution I gave you. The attachment deals with multi letter case. Dj MaxText.fp5.zip
Recommended Posts
This topic is 7996 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