Forum Discussion

arleta's avatar
arleta
Qrew Member
28 days ago

How to check if all emails in the list have one or another domain?

Hi, 

I am trying to set up a field which will check if all of the emails provided in another field of the form have got @X.com or @Y.com domains.

The example of list of emails

a.a@X.com;a.a@Y.com;b.b@Z.com

I would like to have a formula that would tell me that email b.b@Z.com has got a wrong domain and can't be accepted and that only domains @X.com and @Y.com can be accepted.

  • not tested but try something like this.

    var text AllEmails = [My semi delimited email list field]);

    var text EmailOne= Trim(Part($AllEmails,1,";"));
    var user UserTwo =Trim(Part($AllEmails,2,";"));
    var user UserThree= Trim(Part($AllEmails,3,";"));

    etc

    List("\n",

    IF(not contains($EmailOne, "X.com") and not contains($EmailOne, "Y.com"), $EmailOne),

    IF(not contains($EmailTwo, "X.com") and not contains($EmailTwo, "Y.com"), $EmailTwo),

    IF(not contains($EmailThree "X.com") and not contains($EmailThree, "Y.com"), $EmailThree),

    etc .. )