# Need Help Finding Pattern

• August 15th, 07:33 PM
Bridget Eley
Re: Need Help Finding Pattern
Hi Squeed

CalcA finds the number of periods before the string:

PatternCount(Left(Field 1, Position(Field 1, "announced", 1, 1) -1), ".")

CalcB finds the number of periods up to the first period after the string:

PatternCount(Left(Field 1, Position(Field 1, "announced", 1, 1) -1), ".") +
1

Then use Middle and Position functions to extract the sentence:

Middle(Field 1, Position(Field 1, ".", 1, CalcA) + 2, Position(Field 1, ".",
1, CalcB) - Position(Field 1, ".", 1, CalcA ) - 1)

NB You also need to subtract 2 from the result of the 1st Position function
to find the beginning of the sentence and add 1 to the result of subtracting
the 3rd Position function from the 2nd Position function to include the
period at the end of the sentence.

The final calc:

Middle(Field 1, Position(Field 1, ".", 1, PatternCount(Left(Field 1,
Position(Field 1, "announced", 1, 1) -1), ".")) + 2, Position(Field 1, ".",
1, PatternCount(Left(Field 1, Position(Field 1, "announced", 1, 1) -1), ".")
+ 1) - Position(Field 1, ".", 1, PatternCount(Left(Field 1, Position(Field
1, "announced", 1, 1) -1), ".")) - 1)

Bridget Eley

in article [email]8e19e59e.0308150945.3439444eposting.google.com[/email], J. Squeed at
[email]squeed2000[/email] wrote on 16/8/03 3:45 AM:
Quote:

> I have a database that has 2 fields. Field 1 is a text field that
> holds a paragraph of text and Field 2 is a field that captures a
> sentence from field 1. (Or that I want to capture a sentence, I
> haven't figured it out yet)
>
> I am trying to figure out the calculation so that whenever the pattern
> "announced" occurs in the text block of Field 1. Filemaker will
> capture the entire sentence that that word appears in.
>
> So if the text container says something like this :
>
> "Insiders are impressed with the new lineup of the networks. Today NBC
> television announced that it will be adding 2 new comedys to their
> lineup. This is the second major announcement from NBC this month"
>
> What I get is the first sentence in the sentence field.
>
> "Today NBC television announced that it will be adding 2 new comedys
> to their lineup."
>
> So it found announced. And gave me everything to the left of it until
> it found a "." and everything to the right of it until it found a ".".
>
> How do I do this ?
>
> -Squeed