December 23, 200322 yr Hello If I have repeated sentences in my field "sentence" Like Jeremy uses the 4 stage solution. Phil and Brenda decided to make use of the 7 stage procedure. David and Joe always use the 3 stage plan. I am trying to figure out how to text calculate removing everything before the digit "stage" in each sentence. ( each sentence will always have a digit and stage in it. ) and placing that text only in a field called "opening" In the above examples the text I am speaking about is in bold and I would like to have a formula to automate putting that bold text in a field called "opening" I need help with this one. and thanks to you. Much appreciated, Dave [color:"red"]
December 23, 200322 yr Author I need to amend something in the question I asked. I have a further complication. digit "stage" is used in most sentences but sometimes I have to do the same thing I have described but it changes to "Part" digit. A sentence in this case would be. Denny always decided to go with part 4. Cathy made all here quotes based on part 2. So I am asking how to put everything before digit "stage" or "part " digit into a field called "opening" Thanks for your patience. Dave
December 23, 200322 yr Hi, You're basically extracting each string from the x position of your break - the position of the Word at left of your break... In this case, I'd use - a global field (g_Break) populated by either "Stage" or "Part", - a counter (g_counter) from which you'd stop the loop when g_counter = Patterncount(t_Sentance,g_Break) Set it to Null at script beginning- - Pass the content of your Sentance to a global field (g_ToParse) - Loop with a script that : 1. Set the counter to the next value with SetField[g_counter, g_counter+1)] 2. Extract from g_ToParse the 1st string breaking at the end of the 1st occurrence of g_Break SetField[g_Extract = Middle(g_ToParse,1,Position(g_ToParse, g_Break,1,1)+Length(g_Break) 3. Set another global g_StringParsed with SetField[g_StringParsed,Middle(g_Extract ,1,Position(g_Extract ,MiddleWords(g_Extract ,WordCount(Middle(g_Extract ,1,Position(g_Extract ,g_Break,1,1)-1))-1,1),1,1)+Lenght(MiddleWords(g_Extract ,WordCount(Middle(g_Extract ,1,Position(g_Extract ,g_Break,1,1)-1))-1,1)))] 4.Set the content of your new Text Field with SetField[t_NewText,t_NewText&"
December 23, 200322 yr Actually, you could simplify it by extracting each string directly from your Original Sentance, inolving the counter to limit the extraction to the x occurrence of your g_Break. I shouldn't post when I don't have the time to...
December 23, 200322 yr Author I just made a discovery trying to get it to work. It is always the left part of the sentence before whatever I have extracted in the field "type" "type" = "part" or "type" = "stage" Since that is already extracted in a script -I need to get the words that show up in a sentence before or to the left of whatever the contents of field "type" is in the field "wholeSentence" which contains the original sentence. I am not quite sure how to do this . But this is what I have to do which may be somewhat easier. Thanks DAve
December 23, 200322 yr The problem is deciding what you are going to use to define the end of each sentence. Ugo's solution is to use the text "stage" or "part" as the break. What happens when the text you want to extract contains either of these words ? I think ( based on the info provided ) I would use the carriage return as my end of line break. Therefore here is my script - Set Field G_LineCount = PatternCount(Sentence,"
December 23, 200322 yr Well, if either "stage" or "break" can show up and you want to parse all what is before each string, and ignore what is after the separator until the next "." then a simplfied version would be to use the Substitute function. SetField[g_Parsed, "ENDSENTANCE"&Substitute(Substitute(Substitute(t_OriginalSentance, "stage","BREAKHERE"),"part","BREAKHERE"),".","ENDSENTANCE") >>ENDSENTANCEPhil and Brenda decided to make use of the 7 BREAKHERE procedureENDSENTANCE David and Joe always use the 3 BREAKHERE planENDSENTANCE So now, logically, the script will extract each string one by one, comprised from the Position of x occurrence of "ENDSENTANCE" to the Position of x occurrence of "BREAKHERE" - 1 Word.
Create an account or sign in to comment