March 26, 200223 yr I received such great help with a problem I posted earlier, I'd like to throw one more out there if I may. When we import records, the text is all "UPPER CASE". Can I tell FM to select a two fields [First_Name] and [Last_Name], then format all text within every record to be "Title Case"? Thanks in advance, Kip
March 26, 200223 yr OK, can't currently think of a way of making this dynamic, but it does work. So if you only want to change a couple of fields this is one eay. Write a script called Title Case. Freeze Window Allow User Abort [on] (only for testing purposes. Go to record [first] Loop Go to field [First name] Set field [dont specify a field] Proper("First Name") Go to field [Last Name] Set field [dont specify a field] Proper("Last Name") Go to record [next, exit after last End Loop This will make those two fields for all the imported data (or the found set have title case) Someone may come up with a more dynamic way of doing this. HTH.
March 26, 200223 yr Create a calc field: Upper(Left(UpperCaseText, 1) & Lower(Middle(UpperCaseText, 2, 100) Make sure the field is formatted without messing with the upper/lower case settings. OR... If all you want is to display the text correctly, in Layout mode, select the field, go to Format/Text and format it as Title Case.
March 26, 200223 yr See, I knew dan would come up with something. But then Dan why not create a calc field for each field. Proper(fieldname). I just took it that he wanted to change the contents of the actual fields, as opposed to creating additional fields.
March 26, 200223 yr Author Thanks Guys! I'll give it a try! [ March 26, 2002, 02:42 PM: Message edited by: Kip Troendle ]
March 27, 200223 yr You could also use the Replace command, FWIW. In a script it would be: Replace (No dialog, First Name, Proper(First Name)) Replace (No dialog, Last Name, Proper(Last Name)) Of course, with names like McDonald or MacDonald, you'd need to work a little harder... Take a look here for starters.
March 27, 200223 yr I would use the Proper(Text) command here, too. But I would just use the SetField, and not GoToField step. Dealing with the Mc problem is quite easy too.: -------------------------------------------------- SetField First_Name Proper(First_Name) SetField Last_Name Proper(Last_Name) If Left (Last_Name,2) <> “Mc”] Exit Script Else SetField Last_Name Left( Name1, 2) & Upper(Middle( Name1, 3, 1)) & Middle( Name1, 4, Length(Name1) - 3) End If -------------------------------------------------- Of course you can loop this to deal with the current found count, or if you want use a replace, which is, in itself, faster, but here you would have to replace at least twice. I would consider developing this a bit further, once you’ve got your DB in order, and using it as a validation by calculation. That way you can avoid people messing things up again, as FMP will not allow them to enter data in an incorrect manner. Hope this helps: Rigsby
March 27, 200223 yr PS: If you loop this, you will have to change the exit script part: If Left (Last_Name,2) <> “Mc”] Exit Script However, the reason I did it this way is to avoid “mc ally” for example becoming “McAlly” instead of “Mc Ally”. But you can simply change the Exit Script, to Go to next record. Rigsby
Create an account or sign in to comment