Jump to content

Rule for Phone Tags, Phone Numbers and Phone Separators


traba5058

Recommended Posts

Please help. I'm trying to write a rule that does the following:

  1. Add Mobile tag if Mobile Number populated
  2. Add Office tag if Office Number is populated
  3. Add a seperator (2 spaces + | + 2 spaces if both numbers are populated

I started with rules for the tags and a rule to add the separator if both numbers are populated. When I did this, it was only adding 1 space.

Rule 1

if (Rule("RuleFormatMobile") == "")
return "";
else
return 'M: ';

Rule 2

if (Rule("RuleFormatOffice") == "")
return "";
else
return 'O: ';

Rule 3

if (Rule("RuleFormatMobile") == "")
return "";
else if (Rule("RuleFormatOffice") == "")
return "";
return ' | ';

 

Alex suggested the following yesterday:

if (Rule("RuleFormatMobile") && Rule("RuleFormatOffice") !=”” ) //if both these fields are not empty…

return “ ”+ “ ” + “ | “ + Rule("RuleFormatMobile") +  “ ”+ “ ” +  Rule("RuleFormatOffice");

 

I couldn't figure out how to make this work and do what I need it to do. Can someone help?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...