AnsweredAssumed Answered

Which Character is Missing??

Question asked by osensnolf on Nov 15, 2016
Latest reply on Nov 18, 2016 by alquimby

Willing to send a few dollars your way via PayPal for a solution.

 

My developer created the following script for me.  In short, the script looks at a list of words (keywords) and determines if the word appears within certain fields (such as Company, Description, etc).  It works as designed but now I want it to be able to look within a URL and email.

 

My original list of words looks like this..

attorney

lawyer

"law office"

 

 

My new list of words for email and URL looks like this..

*attorney*

*lawyer*

*lawoffice*

 

I think the script is broke because I am using * and because the new list of keywords are within words - not starting at the beginning of the word.

 

What simple tweak do I need to revise to make this work?

 

Thanks in advance. 

 

Set Error Capture [ On ]

Set Variable [ $Script_Overide ; Value:1 ]

If [ Get ( ScriptParameter ) = "Manual" ]

Set Field [ Contacts::MatchingKeywords ; Let([

// Source Keywords

ListA = List(Contacts|KEYWORDS||gServiceSelector::Keywords) ;

ListA = Substitute ( ListA ; "\"" ; "" ) ; // remove "quotes"

// Derived Keywords

ListB = Contacts::cKeywordSearchKeyNoServices;

EqualsWords = "=" & Substitute ( ListB ; [ "¶" ; " "] ; [ "asdf " ; " " ] ; [ " " ; " " ] ;[" " ; "¶="] ) ;

ListB = FactorWords ( ListB ) ;

ListB = FactorList ( ListB ) ;

ListB = List( EqualsWords ; ListB ) ;

~list = FilterValues ( ListA ; ListB ) ;

~list = Substitute ( ~list ; ["¶¶" ; "¶"] ;["¶" ; ", " ] )

];

~list

) ]

Commit Records/Requests

[ Skip data entry validation; No dialog ]

Exit Script [ ]

End If

Go to Layout [ “Contacts List” (Contacts) ]

Refresh Window

Perform Find [ Specified Find Requests: Find Records ; Criteria: Contacts::Service : “Inactive” AND Contacts::MatchingKeywords :

“Refresh” ]

[ Restore ]

If [ Get ( LastError ) ]

Show Custom Dialog [ Title: "Done"; Message: "There are no records that need updating."; Default Button: “OK”, Commit: “Yes” ]

Exit Script [ ]

End If

Replace Field Contents [ Contacts::MatchingKeywords ; Replace with calculation: Let([

// Source Keywords

ListA = List(Contacts|KEYWORDS||gServiceSelector::Keywords) ;

ListA = Substitute ( ListA ; "\"" ; "" ) ; // remove "quotes"

// Derived Keywords

ListB = Contacts::cKeywordSearchKeyNoServices;

EqualsWords = "=" & Substitute ( ListB ; [ "¶" ; " "] ; [ "asdf " ; " " ] ; [ " " ; " " ] ;[" " ; "¶="] ) ;

ListB = FactorWords ( ListB ) ;

ListB = FactorList ( ListB ) ;

ListB = List( EqualsWords ; ListB ) ;

~list = FilterValues ( ListA ; ListB ) ;

~list = Substitute ( ~list ; ["¶¶" ; "¶"] ;["¶" ; ", " ] )

 

];

~list

) ]

[ No dialog ]

Show Custom Dialog [ Title: "Done"; Message: "All records are updated."; Default Button: “OK”, Commit: “Yes” ]

Outcomes