Sam Laundon Posted July 31, 2002 Posted July 31, 2002 1.) I am converting my database to be web friendly and have spaces between a name such as John Smith that I would like to convert to John_Smith. I have over 800 records that I would like to convert. Could some generous soul give me the script for such an action. 2.) Another script I need is to grab the last 4 numbers of a telephone number such as 000-000-(0000), and have the results placed in another field. I have over 100 records I would like this script to perform on. Thanks in advance for your help.
Keith M. Davie Posted July 31, 2002 Posted July 31, 2002 "...spaces between a name such as John Smith that I would like to convert to John_Smith." John Smith is data within a field. Let's assume the field is named "user name". You would want to change the name of the field to "username" or "user_name", to facilitate the code of the url. There is no real reason to connect the data within the field. If_there_was_then_a_long_string_of_data_would_need_to_look_like_this. But that is not necessary. I believe that for the phone number you can handle that with a calc field and do not need a script.
trevorg Posted July 31, 2002 Posted July 31, 2002 Hi, Assuming you have first and last names in the same field this script would work. Goto Record/Request/Page (First) Loop SetField ["NameField","Substitute( NameField, " ", "_")"] Goto Record/Request/Page (Next, Exit After Last) End Loop Using the substitute command will replace all spaces with an underscore. This accomodates all the Betty Lou Parkers to Betty_Lou_Parker. And now for my next trick.... Use this for the phone numbers: (or add only the SetField command to the script above, right below the other SetField to nail two birds with one stone) Goto Record/Request/Page (First) Loop SetField ["DesiredPlacementField","Right(PhoneNumberField, 4)] Goto Record/Request/Page (Next, Exit After Last) End Loop You might want to backup before you run this, you never know if you might later decide you really didn't want to do this to all your data!
Sam Laundon Posted August 2, 2002 Author Posted August 2, 2002 Thanks for the help on this issue. I appreciate it. To explain why I need to replace the space with a "_". I need to create a FMP-Link on each name field and each name field has a first and last name with a space in between. From now on when I enter in a name in the name field I will put a "_" between the first and last name. Thanks again.
Keith M. Davie Posted August 2, 2002 Posted August 2, 2002 If you entered the names in two fields, firstname / lastname, you could concatenate these with the underscore in a calc field (username or c_name), which you would use for your link.
Recommended Posts
This topic is 8218 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