Meir Posted March 11, 2014 Posted March 11, 2014 So I have a business card where the address and other info all share one box. They display like this: «Address»«Address2_rule» «City», «State» «Zip» «Country» «Gap_rule» «Phone1_Label_Rule» «Phone1_Format_Rule» «Phone2_Label_Rule» «Phone2_Format_Rule» «Phone3_Label_Rule» «Phone3_Format_Rule» «Phone4_Label_Rule» «Phone4_Format_Rule» Email: «Email»@epam.com «Other_Label_Rule»«Other» The text box is set to "Adjust text to fit" The phone lines are set to "Do not break on copyfit" Address2 is not involved in any rules for any Phone label or number. When there is no Address 2, my output displays like this: """ 123 Anystreet Citytown, PA, 12356 USA Main: +1(123) 456-7890 ext.12345 Fax: +1(123) 098-7654 Cell: +1(123) 102-9837 Email: JSnow@company.com """ When there is an Address 2, my output displays like this: """ 123 Anystreet Suite 303 Citytown, PA, 12356 USA Main: +1(123) 456-7890 ext.12345 Fax: +1(123) 098-7654 Cell: +1(123) 102-9837 """ When there is no Address2, but an extra line for Phone4, the extension is still on the same line. I need help understand what is going on here. I cannot comprehend why the extension would drop a line only when address2 is present. This is also causing my email to no longer fit in the text box. Attached is my collected files.84150_Epam_BC_Mar-11-2014_07-40-39.zip Quote
step Posted March 11, 2014 Posted March 11, 2014 Do a select all (cmd + A) on the text in that text box, click paragraph, and then click "suppress if empty" and select OK. Quote
Meir Posted March 11, 2014 Author Posted March 11, 2014 This did not have an effect. The Address 2 field was suppressing when it is not present prior to your change. After your change, the extension is still dropping one line when address2 is present. Attached are screen shots. Address 2 drops the extension on all the phone numbers when it is present even though they all fit fine on one line when it is not present.Archive 2.zip Quote
step Posted March 11, 2014 Posted March 11, 2014 Okay, sorry I misread your original post and didn't see an extension in the data file you included. You can edit your phone number rules to replace all spaces with non-breaking spaces and that could solve your problem. (The change is in red. And make sure you check "treat returned strings as tagged text" in the rule editor) var Var1 = "Phone1"; var CaseSelection = "Format 3"; if(CaseSelection == "Format 1") { 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)); } 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)); } if(CaseSelection == "Format 3") { 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))[color="Red"].replace(/\s/g," ")[/color]; } if(CaseSelection == "Format 4") { 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)); } ////////////////////////////////////////////////////////////////////////////////////////////////////// // DO NOT EDIT BELOW THIS LINE /////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// return formatNumber(Trim(thisNumber)); function formatNumber(number01){ var pattern01 = /^(\d{3})[^\d]*(\d{4})$/; // //2201727 or 220-1727 or 220- 1727 var pattern02 = /^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})$/; // 8002201727 or 800-220-1727 or (800)220-1727 or (800) 220-1727 var pattern03 = /^\+?(\d{1})[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})$/; // 18002201727 or 1-800-220-1727 or +1 (800) 220-1727 var pattern04 = /^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})\D*[x#n]\D*(\d+)$/; // 800-220-1727 ext 12345 or (800) 220-1727 ext 12345 var pattern05 = /^\+?(\d{1})[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})\D*[x#n]\D*(\d+)$/; // 1-800-220-1727 ext 12345 or +1 (800) 220-1727 ext 12345 var pattern06 = /^(\d{3})[\D]*(\d{4})\D*[x#n]\D*(\d+)$/; // 2201727 ext 1234 or 220-1727 ext 1234 or 220- 1727 ext 1234 var patternEndExt = /(.)[x#n](.)/; var patternStart1 = /^[\D]*[1]/; if(number01.match(pattern01)){ number01 = number01.replace(pattern01, formatStyle01); return number01; } else if(number01.match(pattern02)){ number01 = number01.replace(pattern02, formatStyle02); return number01; } else if(number01.match(pattern03)){ if (number01.match(patternStart1)){ number01 = number01.replace(pattern03, formatStyle03); return number01; } else { return number01; } } else if(number01.match(pattern04)){ number01 = number01.replace(pattern04, formatStyle04); return number01; } else if(number01.match(pattern05)){ number01 = number01.replace(pattern05, formatStyle05); return number01; } else if(number01.match(pattern06)){ number01 = number01.replace(pattern06, formatStyle06); return number01; } else { //return "no match any pattern"; return number01; } } Quote
Meir Posted March 11, 2014 Author Posted March 11, 2014 Thank you for taking the time to help me. I'm sorry, the extension is not in the data file, as I am using this online and that is where I am encountering the error by a user. However, the error persists in the collect files. I tried your method, but this is making the entire phone number drop to the line below my phone label. I attached a screen shot of the output. Before your change: Main: +1(123) 456-7890 ext.12345 After your change: Main: +1(123) 456-7890 ext.12345 Desired output: Main: +1(123) 456-7890 ext.12345 I have attached updated collect files with records 3-7 demonstrating the issue. You will notice in record 3 that all those lines fit in the text box. Notice how Address2 is present. You will notice in record 4 that all the phone extensions can fit on the same line as their phone numbers. Notice how Address2 is not present. You will notice in record 5 that all those extensions that had previously fit on the same line as the phone number are dropped to the next line. Notice how Address2 is present. You will notice in record 6 that the extension on phone 1 pushes to the next line. Address 2 is present. All the fields that fit in record 3 no longer fit, because phone is taking up two lines instead of 1. In record 4, I displayed that the extension for every phone number can fit on the same line as the phone number. Yet in record 6, the phone number and extension are on different lines. Why is the extension dropping onto the next line only when Address2 is present?Collect_Example.zip Quote
jwhittaker Posted March 11, 2014 Posted March 11, 2014 Can you just add the address2 field on the second line by itself and select suppress if empty instead of using a rule to create a return? I did it and saved it. I'll attach.84150 Epam_BC.pdf Quote
Meir Posted March 11, 2014 Author Posted March 11, 2014 well that works... I still have no idea why it wasn't working the other way, but that'll do. Thank you very much! Quote
jwhittaker Posted March 11, 2014 Posted March 11, 2014 It looks like you had both the Address and Address2_rule line selected and had do not break on copyfit but the address2_rule had a line break in it so it was freakin out. If you select the entire first line and then un-check the don't break on copyfit and it will be fine. Quote
Meir Posted March 11, 2014 Author Posted March 11, 2014 That seems to work too. Makes sense. Thank you. Quote
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.