0 pts.
 Customize Mail Rules set-up to use with with non-mail database
I would like to be able to use a similar tool as Mail Rules in a Notes App to screen/filter out various words when anonymous users submit a form or bulletin. With modifications to a duplicate mail rule functions, (ie changing condition keyword like 'Subject' to 'Topic' etc., to filter certain words on fields used in other Notes application), I take it that this will not work in non-mail notes applications because this is triggered by the mail router. Right? Has anyone been successful in doing this or is there a better way. Would like certain users to maintain rules for the db. Mostly Notes clients.

Software/Hardware used:
ASKED: April 6, 2006  8:01 AM
UPDATED: April 6, 2006  8:54 AM

Answer Wiki:
I think this what you mean, never played with the router, developer see. Sub Censor(ndDiscussion As NotesDocument) %REM Purpose: Not for the faint hearted, this sub replaces swear words with asterisks (*) in the Body and Subject fields of the discussion forum docments. Partial word stemming with find and replace to next space Chr(32). %END REM Dim intExpletive As Integer, i As Integer Dim strFieldContents As String, strAstericks As String Dim aryExpletives(6) As String 'To update banned word list, simply declare 'words changed to protect the innocent another array element aryExpletives(1) = "Word1" aryExpletives(2) = "Word2" aryExpletives(3) = "Word3" aryExpletives(4) = "Word4" aryExpletives(5) = "Word5" aryExpletives(6) = "Word6" Forall e In ndDiscussion.Items If (e.Name = "Subject" Or e.Name = "Body") Then Select Case e.Type Case TEXT: 'eg Subject strFieldContents = Trim$(e.Values(0)) Case RICHTEXT: ' eg Body strFieldContents = Trim$(e.Values) End Select For i = 1 To Ubound(aryExpletives) intExpletive = Instr(strFieldContents, aryExpletives(i)) While (intExpletive > 0) strAstericks = Asterick(Mid$(strFieldContents, intExpletive)) Mid$(strFieldContents, intExpletive, Len(strAstericks)) = strAstericks intExpletive = Instr(strFieldContents, aryExpletives(i)) Wend Next i e.Values = Trim$(strFieldContents) End If End Forall End Sub Function Asterick(strExpletive As String) As String %REM Purpose: Calculate the number of * required to blot out an expeltive Updates: %END REM Dim intSpace As Integer intSpace = Instr(strExpletive, " ") -1 'If the expletive is the only word in the string 'use string length as the number of * required If intSpace < 1 Then intSpace = Len(strExpletive) Asterick = String$(intSpace, Asc("*")) End Function Cheers Paul
Last Wiki Answer Submitted:  April 6, 2006  8:54 am  by  PaulRyan   0 pts.
All Answer Wiki Contributors:  PaulRyan   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _