traba5058 Posted March 14, 2014 Share Posted March 14, 2014 Please help. I'm trying to write a rule that does the following: Add Mobile tag if Mobile Number populatedAdd Office tag if Office Number is populatedAdd 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? Quote Link to comment Share on other sites More sharing options...
jwhittaker Posted March 14, 2014 Share Posted March 14, 2014 On your Rule 3 you need to add an "else" for the last return statement. Also you need to make sure the tagged text is NOT checked. if (Rule("RuleFormatMobile") == "") return ""; else if (Rule("RuleFormatOffice") == "") return ""; else return ' | '; Quote Link to comment Share on other sites More sharing options...
traba5058 Posted March 18, 2014 Author Share Posted March 18, 2014 Thanks so much! That worked. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.