Working with a list

Been at this for a week or so, was wondering if another pair of eyes can find my mistake in this code (here’s the snippet of code):

******** start part of code ******

TO := TO;

listTo := TO;

rfTo := @If(@Contains(listTo; “name1”); @Replace(listTo; “name1”; “”); listTo);

rfTo1:=@If(@Contains(rfTo; “name2”); @Replace(rfTo; “name2”; “”); rfTo);

@MailSend(rfTo1…

**** end part of code *******

I have the above code in an action button on a form “Save and Mail”.

What is happening is, if name1 is not in the list, then it sends mail. But…if name 2 is not in the list, then I get that nice message about no SendTo found.

Any help would be apprieciated. I would include more code if need be, I wasn’t hiding anything, just making it easier for someone to help.

Thanks again,

Chris

Subject: I think this may work…

It’s a lot less typing and should accomplish the same effect: dropping out
name1 and name2 if they appear in the To list.

tt>
TO:=@Trim(@Replace(TO; “name1”:“name2”; “”:“”))

]

name1 and name2 will only be replaced with “” when/if they exist in the list –
there’s no need to do an @Contains first.

The @Trim simply drops out the null the values from the list.

Subject: RE: I think this may work…

Ooooo that’s beautiful. thanks!

Subject: Working with a list-RESOLVED

With my own playing around I finally resolved. Sorry about that everyone. I was getting frustrated.

Anyway, the deal was, there was some code that I didn’t include in the above code:

webTo := @If(@Contains(listTo; “name1”); “name1”; “”);

webTo2 := @If(@Contains(listTo; “name2”); “name2”; “”);

webToList := @Trim(webTo : webTo2);

@If(webToList != “”; @MailSend(webToList

Well, I didn’t have the @Trim on the variable webToList before, once I put that on, the code excecuted just as I like.

Thanks!