Thanks for the response! There's additional functions I'm trying to add to this as well and while the validate button says the expression is OK, it's appearing as {Rule_Address_Format} in my template preview and I'm not sure what I'm doing wrong now.
Here's the code. In addition to the Pipe suppression, I made an abbreviation rule and a secondary address suppression (Actually that isn't working either now) if the client doesn't have a Suite or office number.
var fieldaddress = Field("address"),
fieldaddress2 = Field("address2"),
tm = new FusionProTextMeasure,
address = [Field("address"), Field("address2"), Field("city")].filter(String).join(' ');
//Street Abbreviations
function AddressRules(){
fieldaddress = fieldaddress.replace("Boulevard", "Blvd").replace("Street", "St").replace("Terrace","Ter").replace("Avenue","Ave").replace("Road","Rd");
return fieldaddress;
}
//Secondary Address Suppression
function SuppressAddr2(){
if (fieldaddress2 == "")
return "";
else
return ', '+fieldaddress2;
}
//Allow Pipe Rule
function AllowPipe(input){
tm.font = 'Lato Bold';
tm.pointSize = '87 pt';
tm.maxWidth = FusionPro.inValidation ? 7200 :
GetSettableTextWidth(FindTextFrame(FusionPro.Composition.CurrentFlow.FormatAddress));
tm.CalculateTextExtent(input);
return tm.textLines == 1;}
if (AllowPipe(address) && Field("city"))
address = address.replace(' ' + Field("city"), ' | ' + Field("city"));
return address;