LotusScript 'Contains' question

Can someone tell me what I’m doing wrong here please…I’m simply wanting to check a field if it contains the string “REP”. I can’t save the script and keep getting the error “Initialize: 135 Not an instance name: EMPTYP”

If EmpType.Contains( “REP” ) Then

doc.MOD = “”

doc.SHPTYP = “”

Else

doc.MOD = “PU”

doc.SHPTYP = “P”

End If

Subject: LotusScript ‘Contains’ question

Contains? There’s no “Contains” in LotusScript. I think this is what you’re after:

If Instr(EmpType,“REP”) Then

Subject: RE: LotusScript ‘Contains’ question

Well now that’s embarrasing! I guess that explains why I not much came up when I searched the forum…

Thank you for your help.

Subject: LotusScript ‘Contains’ question

if emptyp is a a document variable, and it can contain a single value then you can use…

if doc.getItemvalue( “emptype”)( 0) = “REP” then

if it is a document variable, and can contain several values then you have to…

dim thisItem as notesItem

set thisItem = doc.getFirstItem( “empType”)

if thisItem.contains( "“REP”) = true then

if your variable is a lotus script, then you could have just said…

if empTyp = “REP” THEN

jmb

Subject: RE: LotusScript ‘Contains’ question

I see. Thank you. The problem started because the value could only be “REP” or something else. But then that changed to be either “REPG” or “REPD” etc…so I figured I would just check for the string “REP”.

Thanks again.

Subject: RE: LotusScript ‘Contains’ question

Except that “equals” is not the same as “contains” – the question gave no indication that the entire string would be “REP”, just that it may contain “REP”.