Daibhead Posted July 19, 2005 Posted July 19, 2005 Hi How do I remove carriage return(s) from the end of a text field. Daibhead
LaRetta Posted July 19, 2005 Posted July 19, 2005 In case this text field has multiple paragraphs, you will only want to remove the very last
sbg2 Posted July 19, 2005 Posted July 19, 2005 To replace all Carriage returns with a space: Substitute(MyTextField;"
Ted S Posted July 19, 2005 Posted July 19, 2005 Ahhhh, you all forgot the most obvious answer: Put your cursor at the end of the field and press the backspace key!
Daibhead Posted July 19, 2005 Author Posted July 19, 2005 Thank you one and all. I'm new to filemaker, so forgive the newbie questions. I am not sure what the "
comment Posted July 19, 2005 Posted July 19, 2005 It tags the end of the text, so that the carriage returns removed are only those at the end.
wmugrad28 Posted July 19, 2005 Posted July 19, 2005 Welcome to FM Forums, What version of FileMaker are you using? If you are using FM Developer 7 then perhaps the pros around here could work with you on creating a recursive function. This would in effect provide the looping type action that you need in your calculation. Greg
wmugrad28 Posted July 19, 2005 Posted July 19, 2005 Ok, I'll give it a try. I'm new to recursive functions myself... and I don't use Developer. For those using Developer: 1. Create a custom function called: TrimEndReturn (textfield) 2. The calc part of it should be something like: Let ([rightcharacter = Right (textfield ; 1); lengthremaining = Length (textfield) - 1]; If (rightcharacter = "
sbg2 Posted July 19, 2005 Posted July 19, 2005 (edited) This has the unfortunate effect of stripping ALL punctuation from the end (as well as the beginning) of the text. hmmm, good point. How about: If(Right(MyTextField; 1) = " Edited July 19, 2005 by Guest Added IF statement
comment Posted July 19, 2005 Posted July 19, 2005 That's a neat idea. If a text field could contain more than 30 returns in a place other than the end of the field then you would just need to add more
sbg2 Posted July 19, 2005 Posted July 19, 2005 Nice, Thats even better. I think that may be as close to actually stripping trailing carriage returns as you can get (without developer). That is of course until FM adds the TrimCR function to version 24 of Filemaker Pro.
-Queue- Posted July 20, 2005 Posted July 20, 2005 Just for fun, here's Bob Weaver's post on optimum nested substitutes.
comment Posted July 20, 2005 Posted July 20, 2005 I actually tried that at first, but couldn't find a way to restrict it to the end of the text. For general use, I believe that method has become obsolete in v.7 - see here.
Zero Tolerence Posted July 20, 2005 Posted July 20, 2005 (edited) Recursive Function I just built. name: Recursive_Remove(txtfield) Let([ a = If ( Right ( txtfield ; 1 ) = " Edited July 20, 2005 by Guest
Søren Dyhr Posted August 6, 2007 Posted August 6, 2007 For general use, I believe that method has become obsolete in v.7 It's time for be fried for believes!!! When will internal functions be ....or which of the native functions are slower than the dealings of iteration max check's when making a recursive CF. The question is if we always should recurse if a chance occures?? If a native function aready have some sort of recursivity inside, should it then be used moderately? Wishfull thinking is if we like in assembler had a list of each native commands utilization of processer time. It's a waste of a developers time to build homebrewed tests each time in doubt, even worse sometimes you should even think up ways, which would give the most reliable measurements! --sd
comment Posted August 6, 2007 Posted August 6, 2007 Thank you for replying, Søren - even if it's after more than two years. Unfortunately, your point is not clear. Please explain why you think I should be fried?
comment Posted August 6, 2007 Posted August 6, 2007 Is this a Socratic question? I know nothing. But I do believe, even now, that it *is* obsolete - because the number of substitutions needs to be limited in advance. Your point is still not clear.
Søren Dyhr Posted August 6, 2007 Posted August 6, 2007 because the number of substitutions needs to be limited in advance Only if we have absolutely no idea as to why these extra pilcrow's have sneedked themselves into our field in question. I have found that a lot of these problems in my solutions, have been avoided by the use of this: http://www.briandunning.com/cf/39 ...which perhaps isn't particular fast but it could be stached away in the buttons oneline script if needed! --sd
comment Posted August 6, 2007 Posted August 6, 2007 I am sorry, but could you explain your point, without branching into another? I don't quite see how knowing the REASON for extra characters being in the field would also tell you HOW MANY of them are there. So, given a choice between two methods, one limited to removing up to 2 or 4 or 10 or 40 etc. consecutive characters, and the other unlimited (at least theoretically), I would go for the unlimited one - all other things being equal. Fry me for it, if you will.
Søren Dyhr Posted August 6, 2007 Posted August 6, 2007 and the other unlimited (at least theoretically), I would go for the unlimited one It seems that you have caught my point! But the excess pilcrows will never creap upon your solution by themselves, so the issue is here pre-emptiveness vs. remedy after deed is done, is the other issue here. Since they have no will of their own, is it usually down to the developers habits to avoid it happens, eventhough he later might know the strongest "Roundup" or posion known to mankind. I could mention 1 NF's one fact per field, that is an attempt to avoid inefficient designs, why should we bother if we always could think up an unlimited method? - Does you statement imply?? No! By propper preparation, isn't recursions always required or are they?? I'm not in doubt that your sense of balance is very good and something a lot of us admires. But impeccable instincts isn't something all of us is graced with, to keep the competititors away with, this is why I ask ...in a simple hope for an explanation: When to develope preemptively, and when to break the rules becasue we always have a posion that can kill the artifact, right at hand. Should we allways develop our recursive functions as tail recursions, simply because they are even more "unlimited"??? Bob Weavers method would with just 4 nested substitutes zap up to 42 successive pilcrows or what ever, isn't it more efficient - when the lions share of the problems only encounters 3-4 if it's done on a regular basis??? --sd
comment Posted August 6, 2007 Posted August 6, 2007 It seems that you have caught my point! I am afraid not. Bob Weavers method would with just 4 nested substitutes zap up to 42 successive pilcrows I believe the actual number is 40, but that's not the point. The point is that my algorithm can zap ANY NUMBER of successive characters, using just 4 substitutions and a TrimAll. In case you haven't noticed, my algorithm is NOT recursive. So why would I ever want to implement Bob Weaver's method, now when TrimAll() is available?
Søren Dyhr Posted August 6, 2007 Posted August 6, 2007 I have accused you wrongly here, I appologize! The TrimAll() method is definately the way to do it! --sd
comment Posted August 7, 2007 Posted August 7, 2007 That's a relief. Can I go for another two years without being fried?
Recommended Posts
This topic is 6575 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