Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted (edited)

Hello, i try to delete a paragraph or sentence if it contains a sting for example

Quote

The prologue of Romeo and Juliet calls the title characters “star-crossed lovers”

And the stars do seem to conspire against these young lovers

 

Romeo is a Montague, and Juliet a Capulet

Their families are enmeshed in a feud, but the moment they meet

when Romeo and his friends attend a party at Juliet’s house in disguise

he two fall in love and quickly decide that they want to be married

in this field i would like to delete all sentence containing string "romeo"  so the result should be : 

Quote

And the stars do seem to conspire against these young lovers

 

Their families are enmeshed in a feud, but the moment they meet

 

he two fall in love and quickly decide that they want to be married

Thanks you :) 

Edited by ibobo
Posted (edited)
44 minutes ago, ibobo said:

i try to delete a paragraph or sentence if it contains a sting

There is a big difference between a paragraph and a sentence. Filemaker knows what a paragraph is (technically, it's a value in a return-separated list), but it has no concept of a sentence.

To remove values containing a string, make your script loop over them and return only those that do not, for example:

Set Variable [ $text; Value:Table::Source ] 
Loop 
  Set Variable [ $i; Value:$i + 1 ] 
  Exit Loop If [ $i > ValueCount ( $text ) ] 
  Set Variable [ $para; Value:MiddleValues ( $text ; $i ; 1 ) ] 
  If [ not PatternCount ( $para ; "romeo" ) ] 
    Set Variable [ $result; Value:$result & $para ] 
  End If 
End Loop 
Set Field [ Table::Target; $result ] 

 

 

 

 

Edited by comment
Posted

Thanks you a lot Comment ! 

it works perfectly B)

last think :angel: if i want add to Romeo many other strings like Juliet, Freud, ..?

Posted

a lot, like 100 -/+, and keep where it s the best ? 

maybe if i put them in a field with different table and PatternCount take it each and loop ?  

 

 

Posted

Hi Comment,

do you know  if i could add that the script that you made : delete also previous paragraph ? 

for exemple : 

Quote

And the stars do seem to conspire against these young lovers

 

Their families are enmeshed in a feud, but the moment they meet

he two fall in love and quickly decide that they want to be married 

if content "two" delete the same paragraph and the previous paragraph. like this : 

 

Quote

And the stars do seem to conspire against these young livers

 

(deleted because previous to "two"

(deleted because of content "two"

Thanks 

Posted

I believe it would be easier to discard a paragraph when it or the next paragraph contain the search string.

To do this, you can change the definition of the $match variable to =

PatternCount ( MiddleValues ( $text ; $i ; 2 ) ; GetValue ( $values ; $j ) )

 

 

 

 

This topic is 3175 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.