June 29, 200619 yr I’ve been struggled with this simple problem and I am sure (or I hope) someone out there has a simple solution. What I try to do is to remove the space and carriage in the last line of text. I know how to use substitute to remove carriage return, but I have a note field that carriage return is ok unless it is the last line of text. The note field need to convert to html format and the last carriage return (returns) is a pain to deal with. Thank you for your help. -JJ
June 29, 200619 yr There are a couple of methods. One of my favorites is the following: LeftWords(MYTABLE::myfield; 999999999) The only problem with this approach is any word separator (return, space, period, etc.) not surrounded by a word is removed. For example, let's say you have the following text in your field: Mary had a little lamb.¶ Not only will the return be removed but so willl the period. However, this solution works great on return-separated lists (like primary keys) because it is easy to implement. If you aren't sure about the data, it is better to use the following formula: Left(MYTABLE::myfield; Length(MYTABLE::myfield) - 1) This willl remove the last character. However, it won't remove more than one character or a random number of undesirable characters which gives an advantage to the LeftWords approach. So, choose the method that best meets your needs.
June 29, 200619 yr Just for preventative maintenance visit the post at the link below. Comment came up with a calculation to remove x number of trailing carriage returns from a field. If you are getting a single trailing carriage return now your users are bound to mistakenly add more later. I know my users do it all the time. I would copy and paste the calculation for you in this thread but I can no longer copy any text on this forum. http://fmforums.com/forum/showtopic.php?tid/168001/post/168343/hl/Remove+carriage+return+sbg2/#168343
Create an account or sign in to comment