Jump to content

Should be an easy one, but I can't figure it out... email addresses


Scott

Recommended Posts

I have a field in my data called "EMAIL"

 

sometimes the data will be blank (nothing needs to print on the bizcard)

sometimes the data will be john.doe

sometimes the data will be john.doe@yahoo.com

 

I need a rule that will add the "@yahoo.com" to the second scenario above, but not disrupt the others.

 

I thought the following would work. But apparently I need a different operator (than !=). Is there someway to use a wildcard in front of @yahoo.com?

 

if (Field("EMAIL") != "@yahoo.com")

return Field("EMAIL");

else

return Field("EMAIL")+'@yahoo.com';

Link to comment
Share on other sites

return (Field("EMAIL") != "" ) ? Field("EMAIL").replace("@yahoo.com","") + "@yahoo.com" : "" ;

 

Basically what this does is first checks to see if the field is blank. If it is, it returns a null value.

 

If it's not, it addresses the "@yahoo.com" scenario by "replacing" the domain with nothing and then adds it back in order to avoid a "you@yahoo.com@yahoo.com" scenario.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...