Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 14th, 2014, 09:41 AM
traba5058 traba5058 is offline
Regular Contributor
 
Join Date: Jan 2012
Location: Atlanta, GA
Posts: 77
Unhappy Rule for Phone Tags, Phone Numbers and Phone Separators

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
Code:
if (Rule("RuleFormatMobile") == "")
	return "";
else
	return 'M: ';
Rule 2
Code:
if (Rule("RuleFormatOffice") == "")
	return "";
else
	return 'O: ';
Rule 3
Code:
if (Rule("RuleFormatMobile") == "")
	return "";
else if (Rule("RuleFormatOffice") == "")
	return "";
	return ' | ';
Alex suggested the following yesterday:
Code:
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?
Reply With Quote
  #2  
Old March 14th, 2014, 02:47 PM
jwhittaker jwhittaker is offline
Senior Contributor
 
Join Date: Feb 2009
Location: San Diego
Posts: 169
Default Re: Rule for Phone Tags, Phone Numbers and Phone Separators

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 ' | ';
__________________
FusionPro VDP Creator 10.0.26 | MacOS 10.13.4 | Acrobat DC
Reply With Quote
  #3  
Old March 18th, 2014, 09:30 AM
traba5058 traba5058 is offline
Regular Contributor
 
Join Date: Jan 2012
Location: Atlanta, GA
Posts: 77
Smile Re: Rule for Phone Tags, Phone Numbers and Phone Separators

Thanks so much! That worked.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:48 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.