Lotus Notes View Help (Formula?)

Hello All,
I would like to create a view in lotus notes that shows all emails (sent & received) based on multiple internet domain names. Example this view should show the emails for @mydomain.com, @thatdomain.com, and @anotherdomain.com. If that exist in the FROM, TO, CC or BCC it should show in the view.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

View selection formula should be something like this:

SELECT @Elements( @Keywords( From : To : CC : BCC; "@mydomain.com" : "@thatdomain.com" : "@anotherdomain.com" ) ) > 0

@Keywords function:
Given two text lists, returns only those items from the second list that are found in the first list

@Keywords( textList1 ; textList2 )

So we count number of domain names found in all those fields combined, and if only one is found we show that document in a view

I haven't tested this...
Sjef BosmanGroupware ConsultantCommented:
My alternative:

SELECT @Right(From : To : CC: BCC; "@") = "@mydomain.com" : "@thatdomain.com" : "@anotherdomain.com"

Also, not tested... :-)
= is a pair wise operator on lists, so it would compare first element from the first list to the first element of the second list, second element of the first with the second element of the second list, ...
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Sjef BosmanGroupware ConsultantCommented:
Soooooooooo sorry.

SELECT @Right(From : To : CC: BCC; "@") *= "@mydomain.com" : "@thatdomain.com" : "@anotherdomain.com"
But you helped me to notice that it should go like this:

SELECT @Elements( @Keywords( @Right(From : To : CC: BCC; "@"); "@mydomain.com" : "@thatdomain.com" : "@anotherdomain.com" ) ) > 0

Open in new window

Permutation isn't considered a smart choice for view formulas, cuz' it would pair every possible combination of values.
I'm not even sure that it would work as you expect.

Lightweight @Keywords is ideal for this.
Sjef BosmanGroupware ConsultantCommented:
Cheat... ;-))

But your formula will always return False. Unless there are addresses with two at-signs in it...
Sjef BosmanGroupware ConsultantCommented:
I'm not sure either, that's why I added (like you): "not tested". But I'd bet to eat my hat again...
I just copied that from you, he he

OK, here's the final version:

SELECT @Elements( @Keywords( @Right(From : To : CC: BCC; "@"); "mydomain.com" : "thatdomain.com" : "anotherdomain.com" ) ) > 0

Open in new window

I don't believe this, you turned out to be right, again  >:( grrr , I stumbled onto the article of Andre Guirard. This is a quote:

             "The *= operator is a little more efficient than using @Keywords"


Sjef BosmanGroupware ConsultantCommented:
dehmerlAuthor Commented:
Thanks guys - I am going to go test it and will let you know how it pans out!
dehmerlAuthor Commented:
Ok Guys,
I have it a try with no luck after replacing the domain names with the 3 I need to search on. No just as an FYI, if I open all docs and do a search for one of the domain names I get results so I know the data exist (I did try the other two domain names with good results also from all docs).
Try this one (we forgot to correct the @ signs), as we found out that it's more efficient (speed):

SELECT @Right(From : To : CC: BCC; "@") *= "mydomain.com" : "thatdomain.com" : "anotherdomain.com"
dehmerlAuthor Commented:
still no joy -- for testing this, I assume I can drop the last two domains on the list to limit down to the one, yes?

Also go figure – one of our notes guys came over as he heard about the issue and took a look…he asked why not @Contains?
They just happen to be tied up with a bigger issue then mine…
Sjef BosmanGroupware ConsultantCommented:
Tested code, try putting it in an agent (set Target to "None"):

from:= "abc@rrr.com";
to:= "abc@rrr.com";
cc:= "abc@mydomain.com":"xyz@anotherdomain.com";
domains:= "mydomain.com" : "thatdomain.com" : "anotherdomain.com";

x:= @Right(From : To : CC: BCC; "@") *= domains;

@Prompt([Ok];"x"; @Implode(@Text(x); ","))

The implode I added just in case, but it isn't necessary because no list is returned.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Try this one:

SELECT ( @Right(From : To : CC: BCC; "@") *= "mydomain.com" : "thatdomain.com" : "anotherdomain.com" ) = 1
Or this one:

SELECT @Elements( @Keywords( @Right(From : To : CC: BCC; "@"); "mydomain.com" : "thatdomain.com" : "anotherdomain.com"; "" ) ) > 0
dehmerlAuthor Commented:
Hi Guys,
Ok, not sure why I have difficulty with the ones you gave me – however if I change the @Right to @Contains it all works and gives me the results I am looking for.
So thanks!

Sjef BosmanGroupware ConsultantCommented:
*image of person scratching head*

Well, if it works for you... But test it really well, for you might have too many or not enough hits that way!
Can you post the formula?
dehmerlAuthor Commented:
SELECT @Contains((From : SendTo : CopyTo : BlindCopyTo ;  "@" ) *= "mydomain.com" : "thatdomain.com" : "anotherdomain.com")
Sjef BosmanGroupware ConsultantCommented:
Why didn't you use a formula like 2 * @Pi * @Square(@Length(From))  ?

Your formula makes no sense whatsoever... Really, you have to test your formula. You can base your test on the code you accepted in this question. Put it in an agent and modify it until it really works, meaning: it allows the addresses you want and it blocks the ones you don't need.
Exactly, this is doing completely wrong thing (checks whether there's sign @ in all those fields).

You can simply add two editable fields on new, test form and then third field, computed with the formula (that takes values from those two fields) and then simply change the values in those editable fields and click F9 to see the computed field reaction.
You can even replace @Pi in Sjef's formula with:

@ATan2( 1; 1 ) * 4

dehmerlAuthor Commented:
Hiya Guys,
Ok, I just opened up the view and it seems I did tweak it a bit more from the one I had on my notes about it…the one I just posted before was from my notes as I messed with it.
Here is what I have in the users database and so far the users they so it is good -
SELECT @Contains(From : SendTo : CopyTo : BlindCopyTo ; "@mydomain.com " : "@thatdomain.com " : "@anotherdomain.com ")
I have to admit this is not my area but your help is really appreciated.
That's fine.
Sjef BosmanGroupware ConsultantCommented:
MUCH better! :-))  
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.