Jump to content

Customizing Format Phone rule


CSzydlowski

Recommended Posts

I'd like to modify the below so that the phone number is set to Bold and a larger font size after the area code. I've been able to Bold the whole thing, but not specifically after the area code. Thank you for any and all help.

 

 

 

if(CaseSelection == "Format 2")

{

var formatStyle01 = "$1-$2"; //simple 7 digit phone

var formatStyle02 = "$1-$2-$3"; //simple 10 digit phone

var formatStyle03 = "+$1 $2-$3-$4"; //10 digit phone starts with 1

var formatStyle04 = "$1-$2-$3 ext.$4"; //10 digit phone with extension

var formatStyle05 = "+$1 $2-$3-$4 ext.$5"; //10 digit phone starts with 1 with extension

var formatStyle06 = "$1-$2 ext.$3"; //7 digit phone with extension

 

var thisNumber = Field(Var1);

 

return formatNumber(Trim(thisNumber));

}

Link to comment
Share on other sites

You don't say what larger point size you want to use, but you can do something like this and put whatever you want in the tags in the second line:

var thisNumber = Field("Phone");
var afterAreaCodeTags = "<z newsize=12>";

var formatStyle01 = afterAreaCodeTags + "$1-$2";             //simple 7 digit phone
var formatStyle02 = "$1-" + afterAreaCodeTags + "$2-$3";            //simple 10 digit phone
var formatStyle03 = "+$1 $2-" + afterAreaCodeTags + "$3-$4";        //10 digit phone starts with 1
var formatStyle04 = "$1-" + afterAreaCodeTags + "$2-$3 ext.$4";        //10 digit phone with extension
var formatStyle05 = "+$1 $2-" + afterAreaCodeTags + "$3-$4 ext.$5";    //10 digit phone starts with 1 with extension
var formatStyle06 = afterAreaCodeTags + "$1-$2 ext.$3";        //7 digit phone with extension

return formatNumber(Trim(thisNumber));

Or, you could use the <magnify> tag, again with a customizable factor, like so:

var thisNumber = Field("Phone");
var afterAreaCodeTags = "<magnify factor=200>";

var formatStyle01 = afterAreaCodeTags + "$1-$2";             //simple 7 digit phone
var formatStyle02 = "$1-" + afterAreaCodeTags + "$2-$3";            //simple 10 digit phone
var formatStyle03 = "+$1 $2-" + afterAreaCodeTags + "$3-$4";        //10 digit phone starts with 1
var formatStyle04 = "$1-" + afterAreaCodeTags + "$2-$3 ext.$4";        //10 digit phone with extension
var formatStyle05 = "+$1 $2-" + afterAreaCodeTags + "$3-$4 ext.$5";    //10 digit phone starts with 1 with extension
var formatStyle06 = afterAreaCodeTags + "$1-$2 ext.$3";        //7 digit phone with extension

return formatNumber(Trim(thisNumber)) + "</magnify>";

Remember to check the "Treat returned strings as tagged text" box.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...