Jump to content

stephsal

Registered Users - Approved
  • Posts

    2
  • Joined

Converted

  • FusionPro Products
    No

stephsal's Achievements

Newbie

Newbie (1/14)

  • First Post Rare
  • Week One Done
  • One Month Later
  • One Year In
  • Conversation Starter Rare

Recent Badges

10

Reputation

  1. 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;
  2. I've been using simple rules for internal client templates and so far this has been straightforward but right now, I'm at a loss to what to for a more complex rule. Disclaimer is I'm not a developer and more of a HTML/CSS person so I've been going in blind for a lot of the more complex (to me) JavaScript (I have been using the W3 School site to try to learn it) - So please bear with me. Currently I'm working on a project on Fusion pro that requires the street address and city of one of our clients. And the format is basically this: <Street Address><Ste or Office number> | <City> However, some of our client addresses are incredibly long and fill the whole line and that causes the line to break and <City> to go to another line. The problem is that the "|" also breaks to the next line and aesthetically it's not the greatest. So what I'm trying to figure out is if the combined address field is longer than the textbox and forces <City> to break to the next line, I'd like to suppress the "|" and have the break as is so it would effectively be: <Street Address><Ste or Office number> <City> I looked through the forums and I saw the threads about using Text Measure, and I've used simple suppression rules before - I'm just at a bit of a loss at how to effectively combine the two so that the suppression rule is triggered when the address fields spans the whole text box length. Thanks!
×
×
  • Create New...