hartmut Posted June 9, 2007 Posted June 9, 2007 Hello I have a situation where I cannot understand how to do something in text formatting. I would like to copy all the left words up to a comma and put it in a new field called "before comma" There are always different amount of words but I would like everything copied up to the comma for examples: three blind mice, and so on - yields "Three Blind mice" I pledge alligiance, to the flag - yield "I pledge alliagiance" Can someone help me with this one. Thanks
mr_vodka Posted June 9, 2007 Posted June 9, 2007 Didnt we already go over this HERE http://www.fmforums.com/forum/showtopic.php?tid/187436/
Lee Smith Posted June 9, 2007 Posted June 9, 2007 Hi Try: Left ( Text ; Position ( Text ; "," ; 1 ; 1 ) - 1 ) HTH Lee
mr_vodka Posted June 9, 2007 Posted June 9, 2007 Try Case ( PatternCount ( field; ","); Left ( field; Position (field; ","; 1; 1 ) -1); field )
Lee Smith Posted June 9, 2007 Posted June 9, 2007 Hi Mr.V I believe you are right. I didn't pick up on it because the data being parsed wasn't mentioned. If it isn't the same thing, [color:blue]hartmut needs to respond as such, other wise I will be deleting this Topic as a duplicate. Lee
comment Posted June 9, 2007 Posted June 9, 2007 (edited) Do you want to learn how to do this, or are you just looking for someone to do it for you? I am asking this, because I think you have been given plenty of guidance here: http://www.fmforums.com/forum/showtopic.php?tid/178408/ and here: http://www.fmforums.com/forum/showtopic.php?tid/181172/ and especially here: http://www.fmforums.com/forum/showtopic.php?tid/187436/tp/0/all/1/ I notice that your "new" question is NOT about some problem that you have run into when trying to implement what you have learned there. --- EDIT: Eh, I am slow today... Edited June 9, 2007 by Guest
hartmut Posted June 9, 2007 Author Posted June 9, 2007 Thanks for the help both of you How do I remove that same text I copies up to the comma from the original field named "unformatted" ex. I pledge allegiance, to the flag ( in the original field "I pledge allegiance" gets inserted into another field but I also need to get "I pledge allegiance" deleted from the field "unformatted"
mr_vodka Posted June 9, 2007 Posted June 9, 2007 Lol. No its not that I changed my mind. I was in a generous mood. ;-). P.S. I didnt realize that you posted when I did.
Lee Smith Posted June 9, 2007 Posted June 9, 2007 How did I know that this question was coming? Trim ( Right ( Text ; Length ( Text ) - Position ( Text ; "," ; 1 ; 1 ) )) Lee
mr_vodka Posted June 9, 2007 Posted June 9, 2007 Ok. Before we go any further, I just wanted to point out that you have been asking almost the same type of questions for some time now. Were the previous posts not sufficient? It seems to me that you are trying to take your yellow page listing and dissect it up into various fields. With all the responses that people have given you, I would assume that you would be able to figure the rest out on your own. I am not trying be to be mean but have you tried playing with the different functions as others have said? (i.e. Left, Right, Middle, MiddleWords, LeftWords, RightWords, etc etc etc): For example, in your previous example, you wanted to get everything up to the comma. I stated that this would give it to you. Case ( PatternCount ( field; ","); Left ( field; Position (field; ","; 1; 1 ) -1); field ) So then if you want the remainder of the text, then it would only make logical sense that you use a right function. Case ( PatternCount ( field; ","); Right ( field; Length (field) - Position (field; ","; 1; 1 ) ); field ) If you want to strip out the leading and or trailing spaces, then wrap it with a Trim () However, since you wanted the rest to be back in the orig field, then you would need to use script to store the parsed values since once the orig value is replaced, then it would be overwritten. What is the purpose of storing the rest of the parsed value into the orig field here? Are you trying to have it recurse?
mr_vodka Posted June 9, 2007 Posted June 9, 2007 Man I am just one step behind you all day today Lee. :
Lee Smith Posted June 9, 2007 Posted June 9, 2007 :giggle: cause you are going into detail, and I'm just slapping posts. The next step here is for [color:blue]hartmut to post a copy of the import text. I have a feeling that you are close with the Yellow Page analogies. Which, as you and I know would be inconsistent from name to name. Lee
hartmut Posted June 10, 2007 Author Posted June 10, 2007 Thanks for your help both of you I won't bother you anymore I am too anxious about my lack of ability Best of Luck
Genx Posted June 10, 2007 Posted June 10, 2007 I won't bother you anymore I am too anxious about my lack of ability Hartmut... We are not trying to be hard on you, and no one actually thinks you have a lack of ability. You show me any of this stuff 2 years ago and I couldn't tell you what it did for the life of me. But I didn't just come back and ask people to vary my calculations for me, I would take it apart, work out what each function did and then try to adapt it myself. If i had trouble then I'd come back... well to be honest at first I'd just stuff around with the numbers and hope it worked lol!! Take this example: Case ( PatternCount ( field; ","); Left ( field; Position (field; ","; 1; 1 ) -1); field ) ... What on earth does any of it mean? It's simply 4 functions: 1) Case( If this ; Do this ; Otherwise Do this ) 2) PatternCount( InThisString ; How many times does this character exist ) In this case, if it exists 1 or more times, then the case requirement ("if this") will evaluate to true. 3) Left( YourString ; How many characters you want to keep) 4) Position ( YourString ; What character you want to know the location of ; where in YourString you want to startlooking ; which occurance of your character do you want ) So put it all together and it says: If a comma exists, then give me everything up to the comma, otherwise if the comma doesn't exist, just give me my text back. Case ( a comma exists ; Give me my field back up to the comma ; otherwise give me my field back )
Lee Smith Posted June 10, 2007 Posted June 10, 2007 (edited) Hi hartmut, Nobody is upset with you. Well, the double posting didn't go over to well, but that happens, and as long as you know we get upset when members do it, then all is forgiven there. Don't beat yourself up if your not understanding these calculations at first. As Genx and comment have pointed out, is you need to look below the surface, pull them apart, and figure out why they are doing what they do. I have made a ton of sample files for myself, just for this purpose. There are books that you can read about using Filemaker, and the Online help and user guide can be helpful. They do provide simple examples of the different Functions. It sounds like to me that you are not getting the results that you want, using the calculations that have been posted. The only way we can help you further is for you to upload a copy of actual text, as I suggested in my previous post. BTW, sometimes it is easier to handle the parsing of your text in a Text Editor like BBEdit, TextWrangler, and TextPad, prior to importing the data into FileMaker. Since you are using the Mac, TextWrangler is a Free editor available at http://www.barebones.com/ Lee Edited June 10, 2007 by Guest
Recommended Posts
This topic is 6437 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