Jump to content

This topic is 7711 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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"]

Posted

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

Posted

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&"

Posted

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... crazy.gif

Posted

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

Posted

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,"

Posted

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.

This topic is 7711 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.