InStr function

Tags:
Lotus Domino
Hi there... In my agent in lotus script i have this code that is checking is the new document already exist in the database if it exist the agent mark the documents as "Duplicated".. the problem is that this code is a little sensitive, and i saw that InStr could be the solution for it, but i dont know where to start. Can anyone help me, please? Function DupCheck2 CRcr$ = Chr(13) Dim emailadd As String Dim session As New notessession Dim db As notesdatabase Dim pdoc As notesdocument Set db = session.currentdatabase Dim dupdoc As notesdocument Set pdoc = db.getprofiledocument("ProfileSetup") DupReason = 0 ' check email address for duplicate in enquiry database 'Print "Checking Email Address" Call logNotes.LogAction("Checking Email Address" ) emailadd = doc.Email_Address(0) If EmailCheck(emailadd, Len(emailadd)) = True Then Set dc = LUEMailAddress(Ucase$(emailadd)) If dc.count > 0 Then 'Print "Document is a Duplicate" Call logNotes.LogAction("Document is a Duplicate" ) DupReason = 1 doc.Duplicate = "YES" Call doc.save(True,True) Goto dupmailsend End If Else 'Print "**Document Marked As Duplicate**" Call logNotes.LogAction("**Document marked as a Duplicate**" ) DupReason = 2 doc.Duplicate = "YES" Call doc.save(True,True) Goto dupmailsend End If ' check phone number for duplicate in enquiry database Print "Checking Telephone Number" Call logNotes.LogAction("Checking Telephone Number" ) telnumber = doc.Home_tel_no(0) telnumber1 = doc.Work_tel_no(0) telnumber2 = doc.Mobile_tel_no(0) 'tnumber = Word(telnumber," ",Len(telnumber)) If TelCheck(telnumber, telnumber1, telnumber2, NumberToUse) = True Then tnumber = Word(NumberToUse," ",Len(NumberToUse)) If DupReason = 0 Then Set dc = LUTelNumber(Ucase$(tnumber)) If dc.count > 0 Then ' Print "Document is a Duplicate" Call logNotes.LogAction("Document is a Duplicate" ) DupReason = 3 doc.Duplicate = "YES" Call doc.save(True,True) Goto dupmailsend End If End If Else ' Print "**Document Marked As Duplicate**" Call logNotes.LogAction("**Document marked as a Duplicate**" ) DupReason = 4 doc.Duplicate = "YES" Call doc.save(True,True) Goto dupmailsend End If 'make search string for postcode/no HouseNo = doc.HouseNo(0) IntQAValue = doc.Post_Code(0) If Instr(IntQAValue, " ") <> 0 Then Spaceval = Instr(IntQAValue, " ") LeftSTr = Left$(IntQAValue, SpaceVal-1) RightStr = Right$(IntQAValue, Len(IntQaValue) - SpaceVal) PCValue = LeftStr + RightStr End If intQAvalue =PCValue + "/" + HouseNo ' If not duplicate so far, check house number and postcode in enquiry database 'Print "Checking Postal Address" Call logNotes.LogAction("Checking Postal Address" ) If DupReason = 0 Then 'If dc.count = 0 Then doc.InternetPossibleDuplicate = "" Set view = enqdb.GetView("(LUInternetEnquiryDuplication)") Call View.Refresh Set dupdoc = view.GetDocumentByKey(IntQAValue, True) If dupdoc Is Nothing Then dupcheck2 = True ' Print "Document Hassed Passed Checks" Call logNotes.LogAction("Document Has Passed Checks" ) Else ' Print "**Document Marked As Duplicate**" Call logNotes.LogAction("**Document marked as a Duplicate**" ) doc.Duplicate = "YES" DupReason = 5 dupval = 1 Call doc.save (True,True) Goto dupmailsend End If
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

LotusScriptMex,

I need some clarification:
– Can you be more specific and ask a more direct question?
– What do you by “sensitive?”
– Based on the code sample, you are using the InStr function already. So, what are you asking?

Charles

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: