Jump to content

step

Registered Users - Approved
  • Posts

    962
  • Joined

Everything posted by step

  1. I'm not entirely sure what you're trying to accomplish. Your first post says you want to drop the extension if it's present in the data. Your example shows an extension. Under the assumption you want to drop the extension: var numbers = ["(p) " + Field("phone"),"(c) " + Field("cell"),"(f) " + Field("fax")]; return numbers.filter(function(s){return s.length>4;}).join(" | ").replace(/\s?[ext](\w*)?\s?\d+/gi,"");
  2. You did not specify what your current rule was. Why don't you just set the text frame to "suppress if empty"?
  3. You could just repurpose the code I just posted, like this: var contact = [Field("name"),Field("title"),Field("department"),Field("email")]; return contact.filter(String).join("<br>");
  4. Use this code instead: var numbers = ["(p) " + Field("phone"),"(c) " + Field("cell"),"(f) " + Field("fax")]; return numbers.filter(function(s){return s.length>4;}).join(" | ");
  5. I would make a table that had two columns, the right being just a fill of black with a set width and the left being your paragraph.
  6. I would replace that character in the data file with the html entity that Eric mentioned in his post.
  7. You don't want to put "Myprepassbenefits" between brackets ([]). Brackets start a character class and finds a match for each character in that class. Basically, you'll replace each of those letters with "MyPrePassBenefits." Secondly, I don't think you'll need to capture >'s or /'s. You can rewrite it like this: return Field("Personalized URLs").replace(/Myprepassbenefits/gi,"MyPrePassBenefits"); Notice that I put an 'i' at the end of the regex so that the match is not case-sensitive. That means this will match "myprepassbenefits" and format it correctly. Hope that helps.
  8. The regular expression recognizes an extension by finding an 'x', a '#', or an 'n'. Only passing "e." to indicate an phone number extension is breaking the rule. That being said, you can modify the "Format 1" portion of the 'if' statement like so to get the results you want: 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 e.$4"; //10 digit phone with extension var formatStyle05 = "$1 $2.$3.$4 e.$5"; //10 digit phone starts with 1 with extension var formatStyle06 = "$1.$2 ext.$3"; //7 digit phone with extension var thisNumber = Field(Var1)[color="Red"].replace(/e/gi,"ext.")[/color]; return formatNumber(Trim(thisNumber)); } Alternatively, you could edit those search patterns to look for an 'e' (though, it's probably not recommended): var pattern04 = /^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})\D*[[color="Red"]e[/color]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*[[color="red"]e[/color]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*[[color="red"]e[/color]x#n]\D*(\d+)$/; // 2201727 ext 1234 or 220-1727 ext 1234 or 220- 1727 ext 1234
  9. You could achieve this using an inline graphic: var contact = [Field("Name"),Field("Address"),Field("Phone#"),Field("Recipient#")]; return (contact.filter(String) != "") ? contact.filter(String).join("<br>") : '<graphic file="Contact.pdf">';
  10. I find that hard to believe. Can you post your fpi file?
  11. If the "crop marks" option is greyed out, you probably have an imposition definition applied to the template. You'd have to edit the crop marks in that .fpi file as Dan said.
  12. It's because you don't have a border set on the header row. You'd have to add this line: // HEADER ROW FORMATTING myTable.Rows[0].Cells[0].Font = "Arial Black"; myTable.Rows[0].Cells[0].PointSize = "10"; myTable.Rows[0].Cells[0].TextColor = "White"; myTable.Rows[0].Cells[0].ShadeColor = "BLUE_HEADER_LINES"; myTable.Rows[0].Cells[0].ShadePct = 100; myTable.Rows[0].Cells[0].Margins = new FPTableMargins; myTable.Rows[0].Cells[0].Margins.Top = 100; myTable.Rows[0].Cells[0].Margins.Right = 750; [color="Red"]myTable.Rows[0].Cells[0].SetBorders("Thin", "BLUE_HEADER_LINES", "Top", "Bottom", "Left", "Right");[/color] myTable.Rows[0].Cells[0].HAlign = "Center"; myTable.Rows[0].Cells[0].VAlign = "Bottom"; myTable.Rows[0].CopyCells(0, 1, 2, 3); // Apply the same formating to each cell in this row // HEADER ROW CONTENT myTable.Rows[0].SetContents("Invoice #", "Invoice Date", "Job Type", "Amount");
  13. I'm sure someone else can give you a cleaner solution, but I think this is what you're looking for: if(FusionPro.Composition.isPreview == true || FusionPro.inValidation == true) { Rule("OnJobStart"); } //Get a count of the total number of records in the external data file numRecsExtDF = externalDF.recordCount; /*============================================================================= || Create arrays to hold values that match the CID of the client's record ||=============================================================================*/ var clientMatch = []; var invoiceMatch = []; var dateMatch = []; var jobMatch = []; var amtMatch = []; // Step through the external data file and push matches into their respective variables if there is a match for (var i=1; i <= numRecsExtDF; i++) { if (externalDF.GetFieldValue(i, 'CID') == Field("Client Number")) { clientMatch.push(externalDF.GetFieldValue(i, 'CID')); invoiceMatch.push(externalDF.GetFieldValue(i, 'Inv #')); dateMatch.push(externalDF.GetFieldValue(i, 'Inv Date')); jobMatch.push(externalDF.GetFieldValue(i, 'Job Type')); amtMatch.push(externalDF.GetFieldValue(i, 'Client Inv Balance')); } } /*============================================================================= || Create the table ||=============================================================================*/ new FPTable; var myTable = new FPTable; myTable.AddColumns(14000, 14000, 14000, 14000); // 1 inch = 7200 pts myTable.AddRows(clientMatch.length+2); // add 2 additional rows (Header and summary lines) // HEADER ROW FORMATTING myTable.Rows[0].Cells[0].Font = "Arial"; myTable.Rows[0].Cells[0].PointSize = "10"; myTable.Rows[0].Cells[0].Font = "Arial Bold"; myTable.Rows[0].Cells[0].TextColor = "White"; myTable.Rows[0].Cells[0].ShadeColor = "BLUE_HEADER_LINES"; myTable.Rows[0].Cells[0].ShadePct = 100; myTable.Rows[0].Cells[0].Margins = new FPTableMargins; myTable.Rows[0].Cells[0].Margins.Top = 50; myTable.Rows[0].Cells[0].Margins.Right = 500; myTable.Rows[0].Cells[0].HAlign = "Center"; myTable.Rows[0].CopyCells(0, 1, 2, 3); // Apply the same formating to each cell in this row // HEADER ROW CONTENT myTable.Rows[0].SetContents("Invoice #", "Invoice Date", "Job Type", "Amount"); // interate through the length of the arrays (data matches from external data file) and create rows for (var i=1; i<=clientMatch.length; i++) { // TABLE CONTENT FORMATTING myTable.Rows[i].Cells[0].Font = "Georgia"; myTable.Rows[i].Cells[0].PointSize = "8"; myTable.Rows[i].Cells[0].HAlign = "Left"; myTable.Rows[i].Cells[0].Margins = new FPTableMargins; myTable.Rows[i].Cells[0].Margins.Top = 40; myTable.Rows[i].Cells[0].Margins.Bottom = 40; myTable.Rows[i].Cells[0].Margins.Right = 500; myTable.Rows[i].Cells[0].SetBorders("Thin", "BLUE_HEADER_LINES", "Bottom"); myTable.Rows[i].Cells[0].HAlign = "Center"; myTable.Rows[i].CopyCells(0,1,2,3); // Apply the same formating to each cell in this row // CREATE CONTENT FOR EXTERNAL DATA FILE RECORDS myTable.Rows[i].SetContents(invoiceMatch[i-1], dateMatch[i-1], jobMatch[i-1], amtMatch[i-1]); } // FOOTER ROW FORMATTING myTable.Rows[clientMatch.length+1].Cells[0].Font = "Arial"; myTable.Rows[clientMatch.length+1].Cells[0].PointSize = "10"; myTable.Rows[clientMatch.length+1].Cells[0].Font = "Arial Bold"; myTable.Rows[clientMatch.length+1].Cells[0].TextColor = "Black"; myTable.Rows[clientMatch.length+1].Cells[0].ShadeColor = "White"; myTable.Rows[clientMatch.length+1].Cells[0].ShadePct = 100; myTable.Rows[clientMatch.length+1].Cells[0].Margins = new FPTableMargins; myTable.Rows[clientMatch.length+1].Cells[0].Margins.Top = 50; myTable.Rows[clientMatch.length+1].Cells[0].Margins.Right = 500; myTable.Rows[clientMatch.length+1].Cells[0].SetBorders("Thin", "BLUE_HEADER_LINES", "Top", "Bottom"); myTable.Rows[clientMatch.length+1].Cells[0].HAlign = "Center"; myTable.Rows[clientMatch.length+1].CopyCells(0, 1, 2, 3); // Apply the same formating to each cell in this row // CREATE FOOTER CONTENT myTable.Rows[clientMatch.length+1].SetContents("TOTAL","","", Field("CLIENT SUMMARY1")); return myTable.MakeTags();
  14. Select the lines you want to adjust the leading of, and then adjust the leading in the paragraph window.
  15. In the text editor window, click paragraph and turn off the hyphenation option
  16. You can give this a shot: // Use TextMeasure to get the length of each company name var tm = new FusionProTextMeasure; var frameWidth = 2; // set width of the text box (in inches) tm.pointSize = "10 pt"; // set the type size tm.font = "Helvetica"; // set your typeface var str = Field("Email"); // set the field to use tm.CalculateTextExtent(str); tm.useTags = false; var tmWidth = tm.textWidth; return (tmWidth < frameWidth*7200) ? str : str.replace("@", "<br>@");
  17. Using the FusionPro.Composition.isPreview property in what capacity? Like this? var extjs = (FusionPro.Composition.isPreview) ? "/Users/Ste/Desktop/_javascript folder/externaljs.js" : "../_javascript folder/externaljs.js"; Load(extjs);
  18. Is there a reason that preview would break when referencing something via a relative path rather than an absolute path? My folder structure is set up as such: -_javascript folder --externaljs.js -_template folder --templatefile.pdf OnJobStart Callback: Load("../_javascript folder/externaljs.js"); // does not allow previews //Load("/Users/Ste/Desktop/_javascript folder/externaljs.js"); // does allow previews Does anyone have any ideas?
  19. It's a specific to JavaScript 1.6. FP8 uses JavaScript 1.7 and earlier releases use 1.5. I guess if dkent is using FP7, this solution might work better for him: var result = ""; result += (Field("phone") != "" ) ? "(p) " + Field("phone") : ""; result += (Field("cell") != "" ) ? "(c) " + Field("cell") : ""; result += (Field("fax") != "" ) ? "(f) " + Field("fax") : ""; return result; Or: var phone = "(p) " + Field("phone"); var cell = "(c) " + Field("cell"); var fax = "(f) " + Field("fax"); return (phone + cell + fax).replace(/\(\D\)\s(?!\d)/g,"");
  20. Try this: var numbers = ["(p) " + Field("phone"),"(c) " + Field("cell"),"(f) " + Field("fax")]; return numbers.filter(function(s){return s.length>4;}).join(" ");
  21. You can certainly move frames with an FP8 server license. But I think the best case for you would be using a table.
  22. Just a guess based on your dif file name, is your template named "CNF VDP SETUP.pdf"? If so, I think it needs to be lowercased in order for the PDF to visible at composition. Not sure why it would work on your desktop though...
  23. I think you can do this: return Field("Email").replace(/@/g,'<span font="Arial">$1</span>');
  24. Sorry, Eric, I have a rule about meeting up with strange "men" from the internet using emoticons. Though I'm sure methogod would be willing to kick you some cash for double-checking my solution
×
×
  • Create New...