Where I have mistake?

Hi all,

I need compare multivalue field “PersonList” with value in tmp, but this sequence do not work

            Set item2 = doc.GetFirstItem( "PersonList" )

If Not item2.Contains( tmp ) Then

   Call item2.appendtotextlist(tmp)

   Call doc.Save( True, True )

End If

Where I have mistake?

Subject: Where I have mistake?

What is tmp declared as (contains)? Help states tmp would have to be a String, number, or variant of type DATE.

IT also seems to indicated it returns a variant vs a boolean. So you might want to set the contains to a variant to make sure you’re getting a boolean back or not.

Subject: RE: Where I have mistake?

tmp is declared as string.

I read this value from SQL source by this sequence

tmp = dbres.getvalue(“value”, tmp)

tmp is correctly name

Subject: RE: Where I have mistake?

And did you check the value returned by “item2.Contains( tmp )” as the help seems to indicate it’s a variant and not a boolean as you have it coded.

Subject: RE: Where I have mistake?

“does not work” is too vague. What exactly does it do instead of working?

I notice this code assumes that the item “PersonList” already exists. Are you sure that it does? If it does not, you will get an error (Object variable not set). If it exists but is blank, then you will get a two-element list whose first element is blank.