Jump to content

step

Registered Users - Approved
  • Posts

    962
  • Joined

Everything posted by step

  1. Have you tried changing the duplexing method? Layout > Advanced > Duplexing > Flip on Short Edge Bleed=0 CenterLayout=True CropMarkLength=0.25 CropMarkOffset=0.125 CropMarks=True DiscardGutterC_0=None DiscardGutterR_0=None FaceUpStacking=True [color="Red"]FlipOnShortEdge=True[/color] HorizontalPosition=0 HSigOrder=LeftToRight PagesPerRecord=8 PrimaryRepeatCount=1 PrimaryRepeatDirection=None PrimaryRepeatDuplicate=False PrimaryRepeatInfiniteStack=False PrimaryRepeatSpacing=0.25 Rotation=-90 SecondaryRepeatCount=1 SecondaryRepeatDirection=None SecondaryRepeatDuplicate=False SecondaryRepeatInfiniteStack=False SecondaryRepeatSpacing=0.25 SignatureRotation_0_0=0 SignatureType=Saddle Stitched Slug= SubstrateHeight=18 SubstrateWidth=12 TertiaryRepeatCount=1 TertiaryRepeatDirection=None TertiaryRepeatDuplicate=False TertiaryRepeatSpacing=0.25 TrimBoxHeight=11 TrimBoxWidth=8.5 Units=Inches Version=3 VerticalPosition=0 VSigOrder=TopToBottom
  2. I don't think that functionality exists but maybe if you post an example of what you're trying to match, we could come up with a work around.
  3. To better understand what the code is doing, you should first take a look at how the 'forEach' method works. I'll try to explain how the code I wrote works: We start with an array of all of your text frame names. The 'forEach' method passes each of the elements in that array (your frames) into the function as the variable 's,' though you could name it whatever you want. I just happen to be partial to the letter "S." Within the function, I created the variable 'cert' which is just the "Cert ID" field less 1 and converted to an integer. Arrays are zero-indexed – meaning that the first element is at position '0', the second at position '1', etc. With that in mind, I use the 'cert' variable to return the 0th position of the 'states' array when "Cert ID" is "1" and the 1st position of the 'states' array when "Cert ID" is "2". The 'states' array is an array of arrays. I'm using it to determine which list of states to use for a given "Cert ID." So to illustrate: // Assuming // Field("Cert ID") == '1' // Field("State") == 'OH' var cert = Field('Cert ID'); // returns "1" (string) cert = Int(cert); // returns 1 (integer) cert = cert - 1; // returns 0 (integer) /* * Another way to write the 'states' array that might * make it a little clearer what's happening: * * var states = []; // [] (empty array) * states[0] = ['OH','TX']; // [['OH','TX']] * states[1] = ['ID','IL']; // [ * // ['OH','TX'], // <-- Position 0 * // ['ID','IL'] // <-- Position 1 * // ]; */ var states = [ ['OH','TX'], ['ID','IL'] ][cert]; // [ ['OH','TX'], ['ID','IL'] ][0]; // ['OH','TX'] With the correct list array of states assigned to the 'states' variable, I can use '.indexOf' which returns the position of an element in an array. So, in this case I'm searching the 'states' array for the value of the 'State' field. If the state exists in the array, the posistion is returned, if it's not found, -1 is returned. I compare the value of the 'indexOf' method to -1 which gives us a boolean value (true/false). Adding 1 to the boolean will interpret it as a 1/0 instead of true/false. Thus: if the state exists in the 'states' array use the "_2" frame (suppressing everything else). Here's another illustration using the same values from earlier: // Assuming // Field("Cert ID") == '1' // Field("State") == 'OH' var cert = Int(Field('Cert ID') - 1); // 0 var states = [ ['OH','TX'], ['ID','IL'] ][cert]; // ['OH','TX'] var frame = states.indexOf(Field('State')); // 0 // <-- Notice that 'OH' is the 0th position of the states array frame = (frame > -1); // true frame = (frame + 1); // true + 1 == 1 + 1 == 2 frame = 'Cert' + Field('Cert ID') + '_' + frame; // Cert1_2 And lastly, now that we know which frame is being used, it's just a matter of suppressing the ones that aren't that frame: FindTextFrame(s).suppress = s != frame; So to answer your question regarding adding new variables, you'll need to add the new frames to the inital array. After that, you'd just assign the list of states to the corresponding position in the 'states' array. For example, if 'Cert3_2' should be used for "IL" and "ID," your 'states' array would be modified to look like this: var states = [ ['OH','TX'], ['ID','IL'][color="Red"], ['ID','IL'][/color] ][cert]; Good luck!
  4. There's a problem with the syntax of your if/else statement. Since you have the 'else' statement (in green), you don't need the extra 'if' statement (in red): if (Field("Cert ID") == "1") { if ((Field("State") == "OH") || (Field("State") == "TX")) FindTextFrame("Cert1_1").suppress = true; else FindTextFrame("Cert1_2").suppress = true; } [color="SeaGreen"]else {[/color] [color="Red"]if (Field("Cert ID") == "2") {[/color] if ((Field("State") == "ID") || (Field("State") == "IL")) FindTextFrame("Cert2_1").suppress = true; else FindTextFrame("Cert2_2").suppress = true; [color="red"]}[/color] [color="SeaGreen"]}[/color] Or you could use 'else if': if (Field("Cert ID") == "1") { if ((Field("State") == "OH") || (Field("State") == "TX")) FindTextFrame("Cert1_1").suppress = true; else FindTextFrame("Cert1_2").suppress = true; } [color="Red"]else if[/color] (Field("Cert ID") == "2") { if ((Field("State") == "ID") || (Field("State") == "IL")) FindTextFrame("Cert2_1").suppress = true; else FindTextFrame("Cert2_2").suppress = true; } That being said, your current code only handles suppressing frames "Cert1_1" and "Cert1_2" when the "Cert ID" is "1." In other words, when the "Cert ID" is "2," your code doesn't try to suppress the Cert1 frames. I get the impression from your post that you want to suppress all Cert1 frames when the "Cert ID" is "2." If that's the case, you could try writing your rule like this: FindTextFrame("Cert1_1").suppress = (Field("Cert ID") == "Cert2" || Field("State") == "OH" || Field("State") == "TX"); FindTextFrame("Cert1_2").suppress = (Field("Cert ID") == "Cert2" || Field("State") != "OH" || Field("State") != "TX"); FindTextFrame("Cert2_1").suppress = (Field("Cert ID") == "Cert1" || Field("State") == "ID") || (Field("State") == "IL"); FindTextFrame("Cert2_2").suppress = (Field("Cert ID") == "Cert1" || Field("State") != "ID") || (Field("State") != "IL"); You could also reduce some of that redundancy by determine which frame won't need to be suppressed and suppressing the rest using the forEach method: ['Cert1_1','Cert1_2','Cert2_1','Cert2_2'] .forEach( function(s) { var cert = Int(Field('Cert ID') - 1); var states = [ ['OH','TX'], ['ID','IL'] ][cert]; var frame = 'Cert' + Field('Cert ID') + '_' + ((states.indexOf(Field('State')) > -1) + 1); FindTextFrame(s).suppress = s != frame; });
  5. Okay, so, maybe an explanation of what the code is doing would be helpful: The 'cover' variable is set to true when the modulus of the input record number and 50 is 1. It looks confusing but you can just think of it as a counter that counts up to 50 and then starts over at 1. So the first record % 50 == 1, the 51st record % 50 == 1, etc. We use that information to determine which records will start the stack because we want to add a cover sheet to them. Instead of actually adding in additional records for "covers," we're just going to repeat that record twice – once as a cover and once as a "pad". Without repeating the record, you'll eliminate that record from the "pad" and it will only show as the "cover" sheet and that's why your sequential numbering seems off when you use the above rule. With my above explanation in mind, you need to consider that adding a cover sheet to a stack of 50 pads results in a stack of 51 pads. Perhaps the simplest solution is to set your stack height (plus 1 for the cover sheets) in your FPI file and build the template off of that information. That way you can set the stack height to 3 (for a stack of 2 pads and 1 cover sheet) and your sequence numbers and stacking would adapt. To do that you can make these changes: JavaScript Globals: var stackHeight = 1; OnJobStart: FusionPro.Composition.forcePreprocessing = true; FusionPro.Composition.chunksBreakStacks = true; // Get the name of the FPI file from the cfg file var fpiFile = FusionPro.Composition.JobOptions["ImpositionDefFileName"]; // Import the .fpi file as an external data file delimited by returns (\n) var ex = new ExternalDataFileEx(fpiFile,'\n'); // Print Error if the template can't link to the fpi file if(!ex.valid) Print('* Failed to link to the FPI file in OnJobStart. Assuming 1 up *'); for (var i=0; i<=ex.recordCount; i++){ var [prop,val] = ex.GetFieldValue(i,0).split("="); if ( val == 'Stack' ) stackHeight = Int(ex.GetFieldValue(i-1,0).split('=').pop()) - 1; } OnRecordStart: if (cover = FusionPro.Composition.inputRecordNumber % stackHeight == 1) FusionPro.Composition.repeatRecordCount = 2; var page = (cover && FusionPro.Composition.repeatRecordNumber == 1) ? 'cover' : 'pad'; FusionPro.Composition.SetBodyPageUsage(page,true); FusionPro.Composition.SetBodyPageUsage(page + '-back', true); Range Rule: var start = FusionPro.Composition.inputRecordNumber + 10000; var end = start + stackHeight -1; return FormatNumber('0000000', start) + ' to ' + FormatNumber('0000000', end); Unfortunately, having less than 60 stacks of 51 pages, will result in undesirable results because of the way telescoping works in FusionPro. If you'd like to have fixed stack heights – meaning a stack height of "51" will result in a 51 page PDF whether you have 1 record or 60 records, I touch on a way to do that in this thread.
  6. Are the literal tags showing in the text frame when you preview/compose? If so, there's a pretty good chance that you didn't check the "Treat returned strings as tagged text" checkbox at the top of the rule editor. Checking that box will cause FP to actually interpret those tags and apply the font and size to your text rather than print them.
  7. I don't have much experience with working with curved text frames, but it seems like you could potentially remove some points/limit the curve that your text is allowed to use by clicking "Edit Curve" and using the "Add Point" and "Delete Point" buttons to get text area the width you desire. Then you could click "Properties" and select "Shrink" as your copyfit option. If you want to handle this in a rule, you can use the "CopyfitLine" function: var yourText = Field('text'); var font = 'Helvetica'; var fontSize = 12; var width = 72; // Width of the text before shrinking (in points) var shrinkSize = 10; return CopyfitLine('', yourText, font, fontSize, width, shrinkSize); I think you'd be better off determining when to change the font by the width of the text (above) rather than the number of characters in the string because most fonts are not fixed-width. Basically, the number of characters in a string is not entirely indicative of the width of the string. Notice both strings below have 5 characters: But, since you asked, here's how you could do that: var yourText = Field('text'); if (yourText.length > 9) yourText = '<z newsize="[color="Red"]10[/color]">' + yourText; return yourText; And you'd change the 10 to be whatever size you'd want the size to be reduced to if the field has more than 9 characters.
  8. Doing this pretty much defeats the purpose of the 'filter' method. Consider a situation where both fields ("First Name" and "Last Name") are empty: var FirstLast = Field('First Name') + " " + Field('Last Name ') + ", "; // FirstLast = [color="Red"]" , "[/color] var v_field = [FirstLast, Field('Credentials') ].filter(String); // v_field = [[color="red"]" , "[/color], Field('Credentials')] A more appropriate way to handle that is: var FirstLast = Field('First Name') + ' ' + Field('Last Name'); // FirstLast = ' ' if (FirstLast = Trim(FirstLast)) FirstLast += ', '; var v_field = [ FirstLast, Field('Credentials') ].filter(String); // v_field = [ Field('Credentials') ] Or: var v_field = [[Field('First Name'),Field('Last Name')].filter(String).join(' '), Field('Credentials')].filter(String).join(', '); // v_field = [ Field('Credentials') ]
  9. You need to name the frame that the Rule('name') is shown in.
  10. There's no need to apologize. No, it's not an array – it's a regular expression. In regular expressions (or RegExps), the brackets denote a character set. In this case, the character set is a '.' and a ',' but since the '.' has a special meaning in regexps, it has to be escaped with a backslash. The 'g' at the end means to search for those characters globally – don't just find and replace the first instance.
  11. var lastName = Field('LastName'); if (/(s|x|ch|z)$/i.test(lastName)) lastName += 'e'; return lastName + 's';
  12. One thing you could do is to create a text rule to return your name and credentials called "Name": var name = Field('name'); var creds = Field('creds'); return [] .concat(name, creds.split(',')) .map( function(s) { return Trim(s); }) .filter(String) .join(', '); Then you could insert that into a text frame along with other rules/variables and let onCopyfit handle the resizing of your text by inserting this into the onCopyFit callback: var cf = FusionPro.Composition.CurrentFlow var rule = 'Name'; if (!Copyfit(new MagnifyAttributes("text", 25, 400, 6, 72))) { ReportWarning("Could not copyfit text in flow " + FusionPro.Composition.CurrentFlow.name); } else { if (Rule(rule)) { var factor = Int((cf.content.match(/factor="(\d+)"/) || ['','100'])[1]) / 100; var tag = '<variable name="' + rule + '">'; var find = new RegExp('<para.*?(?='+tag+')', '') var paragraph = (cf.content.match(find) || [''])[0]; var font = (paragraph.match(/<f name="([^"]+)"/) || ['','Arial'])[1]; var size = Int((paragraph.match(/<z newsize="([^"]+)"/) || ['','12'])[1]) * factor; var tm = new FusionProTextMeasure; tm.font = font; tm.pointSize = Int(size) + 'pt'; tm.maxWidth = GetSettableTextWidth(FindTextFrame(cf.name)); tm.CalculateTextExtent(Rule(rule)); if (tm.textLines > 2) cf.content = cf.content.replace(new RegExp(tag, ''), '<color name="Red">Certifications exceed the allotted space</color>'); } } That allows you to more accurately determine if "Name" will require 1 or 2 lines after the frame has been "copyfit" to ensure the text flow fits in the frame. I suppose you could play around with those settings in order to reduce the tracking to a minimum of 85% before wrapping the "Name" to a second line if you wanted to but I'll leave that up to you.
  13. return Field('Your Field').replace(/[\.,]/g,'€');
  14. No problem! Glad that worked for you Well, the code you wrote gives you a range from the current input record number to 50 records from the current input record number – so that part is exactly right. If you don't want to start the sequence at 1, add 10,000 to your starting place: var start = FusionPro.Composition.inputRecordNumber[color="Red"] + 10000[/color]; var end = start + 50; return start + ' to ' + end; If you need to pad the number to 7 digits, you can do that with the "FormatNumber" function: var start = FusionPro.Composition.inputRecordNumber + 10000; var end = start + 50; return FormatNumber('0000000', start) + ' to ' + FormatNumber('0000000', end); Or if you're in to one-liners for the sake of being one-liners: return [0,0].map(function(s,p){ return FormatNumber('0000000', FusionPro.Composition.inputRecordNumber + 10000 + p * 50)}).join(' to ');
  15. Do the cover and the pages share a common back? If so, you wouldn't have to change anything in the code – you'd just set your pages up like this: pg1 'cover' (unused) pg2 'pad' (unused) pg3 'back' Note that the 'back' page (page 3) is not set to unused in that example. That's because regardless of which page is active for the record, we want page 3 to print as the back for every record. What's more likely, though, is that you have unique backs for the 'cover' page and the 'pad' page. The easiest thing to do in that scenario is to set your back pages up in a similar manner to how the front pages are set up: pg1 'cover' (unused) pg2 'cover-back' (unused) pg3 'pad' (unused) pg4 'pad-back' (unused) Here we've set all of the pages to unused but all we have to determine is whether or not we're going to use the 'pad' version or the 'cover' version. Since that's essentially what the original code is doing, only the following addition would have to be made (in red): if (cover = FusionPro.Composition.inputRecordNumber % 25 == 1) FusionPro.Composition.repeatRecordCount = 2; var page = (cover && FusionPro.Composition.repeatRecordNumber == 1) ? 'cover' : 'pad'; FusionPro.Composition.SetBodyPageUsage(page,true); [color="Red"]FusionPro.Composition.SetBodyPageUsage(page + '-back', true);[/color]
  16. Why not just set your "Overflow options" to add pages "So that last added page is even"?
  17. I think it has to do with the word boundaries that I set in the RegExp. Try replacing it with this: new RegExp('.*(' + keyword + ').*', 'gi')
  18. Okay, I think you should be able to make your existing code work by making the following edits: //Create an empty variable that will be populated with a //string of text that lists the customer's purchases returnStr = ''; var pod = 0; var CustomState = ''; [color="red"]var keyword = 'key'; // Your keyword var flagColor = 'Red'; // The color you want the Description & SKU cells to be if keyword is found var flagShade = 50; // The tint you of 'flagColor' you want the cells to display[/color] 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; // margins="top:720;left:7200" returnStr += '<table columns="6" title="Top" alignment="right" shadestyle="by:row;first:1,Gray,50;next:1,White,0" margins="left:0;top:0;bottom:30;right:0" >'; returnStr += '<column width="10000">'; returnStr += '<column width="6000">'; returnStr += '<column width="5800" >'; returnStr += '<column width="10000">'; returnStr += '<column width="24000">'; returnStr += '<column width="5000">'; var backGroundShading = 0; shadestyle="by:row;first:3,green,5;next:1,red,5" for (recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++) { //Compare the value of the OrderID field in the current record //we are looking at in the external data file to the value //of the Orderid field in the main data file. if (externalDF.GetFieldValue(recordWalker, 'OrderID') == Field("OrderID")) { { // Internal ID qty = externalDF.GetFieldValue(recordWalker, 'Quantity'); pod = externalDF.GetFieldValue(recordWalker, 'POD'); returnStr += '<row>'; [color="red"]var shading = flagColor && new RegExp('(\\b' + keyword + '\\b)', 'gi') .test(externalDF.GetFieldValue(recordWalker, 'ProductDescription')) ? 'shading="' + [flagColor,(flagShade || 100)].join(',') + '" ' : '';[/color] backGroundShading = 0; if(recordWalker % 2 == 1){ backGroundShading = 5; } returnStr += '<cell margins="left:0;right:0;botton:0">' + '<p quad="L" br = "false">' if (externalDF.GetFieldValue(recordWalker, 'StateKit') == '1') { CustomState = ' (' + Left(externalDF.GetFieldValue(recordWalker, 'CustomState'),3) + ')' returnStr += '<b> STATE KIT ' + CustomState + ' </b>'; } else { returnStr += externalDF.GetFieldValue(recordWalker, 'Category'); } returnStr += '<cell margins="left:0;right:0;botton:0">' + '<p quad="L" br = "false">' + externalDF.GetFieldValue(recordWalker, 'Location'); if (pod == 1){ returnStr += ' (POD)'; } returnStr += '<cell margins="left:0;right:0;botton:0">' + '<p quad="R" br = "false">' + FormatNumber('#,###', qty) + ' '; if (externalDF.GetFieldValue(recordWalker, 'StateKit') == '1') { returnStr += '<cell[color="red"] '+ shading +' [/color]margins="left:0;right:0;botton:0">' + '<p quad="L" br = "false"> ' + externalDF.GetFieldValue(recordWalker, 'SKU') + '<b>' + CustomState + '</b>' ; returnStr += '<cell[color="red"] '+ shading +'[/color]margins="left:0;right:0;botton:0">' + '<p quad="L" br = "false"><b>' + Left(externalDF.GetFieldValue(recordWalker, 'ProductDescription'),55) + '</b>'; } else { returnStr += '<cell[color="red"] '+ shading +' [/color]margins="left:0;right:0;botton:0">' + '<p quad="L" br = "false"> ' + externalDF.GetFieldValue(recordWalker, 'SKU'); returnStr += '<cell[color="Red"] '+ shading +' [/color]margins="left:0;right:0;botton:0">' + '<p quad="L" br = "false">' + Left(externalDF.GetFieldValue(recordWalker, 'ProductDescription'),40); } returnStr += '<cell margins="left:0;right:0;botton:0">' + '<p quad="L" br = "false">' + externalDF.GetFieldValue(recordWalker, 'Sequence'); } } } // returnStr += '<row type="footer">'; // returnStr += '<cell hstraddle="6" rulings="top:thin,Black"> <cell><cell><cell><cell>'; returnStr += '</table>'; return returnStr; What that does is: checks the 'ProductDescription' field of each record for the presence of "key" (you replace this with the word you're looking for). If it's found, it sets the "shading" variable to the value necessary to shade the background of the ProductDescription cell and SKU cell the specified color (in the case of this example: 50% Red). That being said, there are a number of things in your existing code that aren't necessary. For example the brackets ({ }) before and after the "internal ID" section or the section that sets the value of a 'backGroundShading' variable that is never used in the rule. Instead of diving into the particulars of that, I think you could benefit more from the use of the 'FPTable' constructor. That would allow for some simplification in your code: var numRecsExtDF = externalDF.recordCount; var keyword = 'key'; var flagColor = 'Red'; var flagShade = 50; if (IsPreview() || FusionPro.inValidation) { Rule("OnJobStart"); } var table = new FPTable(); table.AddColumns(10000, 6000, 5800, 10000, 24000, 5000); // Set the shading rules table.ShadingColor1 = "Green"; table.ShadingPct1 = 5; table.ShadingRepeat1 = 3; table.ShadingColor2 = "Red"; table.ShadingPct2 = 5; table.ShadingRepeat2 = 1; table.ShadingType = "ByRow"; for (var recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++) { // If the OrderID's don't match, skip it. if (Field("OrderID") != ExField('OrderID')) continue; // Variable add rows var row = table.AddRow(); // Set cell properties (alignment & margins) var cell = row.Cells[0]; cell.Margins = {'Left': 200, 'Right': 200}; cell.HAlign = 'Left'; // Apply them to all cells on this row row.CopyCells(0, 1, 2, 3, 4, 5); // Helper variables var pod = ExField('POD') == '1' ? ' (POD)' : ''; var sk = ExField('StateKit') == '1'; var customState = Left(ExField('CustomState'), 3); // Variables that will hold the content of your columns var category = sk ? '<b>STATE KIT (' + customState + ')</b>' : ExField('Category'); var location = ExField('Location') + pod; var qty = '<p quad="R" br=false>' + ExField('Quantity'); var sku = ExField('SKU') + (sk ? '<b>' + customState + '</b>' : ''); var desc = Left(ExField('ProductDescription'), (sk ? 55 : 40)); var seq = ExField('Sequence'); // Search for the 'keyword' in 'ProductDescription' if (new RegExp('(\\b' + keyword + '\\b)', 'gi').test(ExField('ProductDescription')) && flagColor) { [row.Cells[3], row.Cells[4]].forEach(function(s) { s.ShadeColor = flagColor s.ShadePct = flagShade || 100; }); } // Assign the variables to the columns row.SetContents(category, location, qty, sku, desc, seq); } // Let FP convert the table into tags return table.MakeTags(); // Helper function to return external field values function ExField(str) { return externalDF.GetFieldValue(recordWalker, str); } And if you happen to be using FP9, you can take advantage of the 'findRecords' function which will pull only the records that match the current 'OrderID' so that you don't have to iterate over the entire data file: var keyword = 'key'; var flagColor = 'Red'; var flagShade = 50; if (IsPreview() || FusionPro.inValidation) { Rule("OnJobStart"); } var table = new FPTable(); table.AddColumns(10000, 6000, 5800, 10000, 24000, 5000); // Set the shading rules table.ShadingColor1 = "Green"; table.ShadingPct1 = 5; table.ShadingRepeat1 = 3; table.ShadingColor2 = "Red"; table.ShadingPct2 = 5; table.ShadingRepeat2 = 1; table.ShadingType = "ByRow"; var records = externalDF.FindRecords('OrderID', Field("OrderID")); for (var rec in records) { // Variable add rows var row = table.AddRow(); // Set cell properties (alignment & margins) var cell = row.Cells[0]; cell.Margins = {'Left': 200, 'Right': 200}; cell.HAlign = 'Left'; // Apply them to all cells on this row row.CopyCells(0, 1, 2, 3, 4, 5); // Helper variables var pod = ExField('POD') == '1' ? ' (POD)' : ''; var sk = ExField('StateKit') == '1'; var customState = Left(ExField('CustomState'), 3); // Variables that will hold the content of your columns var category = sk ? '<b>STATE KIT (' + customState + ')</b>' : ExField('Category'); var location = ExField('Location') + pod; var qty = '<p quad="R" br=false>' + ExField('Quantity'); var sku = ExField('SKU') + (sk ? '<b>' + customState + '</b>' : ''); var desc = Left(ExField('ProductDescription'), (sk ? 55 : 40)); var seq = ExField('Sequence'); // Search for the 'keyword' in 'ProductDescription' if (new RegExp('(\\b' + keyword + '\\b)', 'gi').test(ExField('ProductDescription')) && flagColor) { [row.Cells[3], row.Cells[4]].forEach(function(s) { s.ShadeColor = flagColor s.ShadePct = flagShade || 100; }); } // Assign the variables to the columns row.SetContents(category, location, qty, sku, desc, seq); } // Let FP convert the table into tags return table.MakeTags(); // Helper function to return external field values function ExField(str) { return externalDF.GetFieldValue(records[rec], str); }
  19. It would be helpful if you included the rule. Especially if you're looking for a response that isn't abstract.
  20. You can specify a tab delimiter and reference the field by name like this if you want: var ex = new ExternalDataFileEx(PrimaryInputFile(), '\t'); NextOrderNumber = ex.GetFieldValue(rec, 'Order_Number'); The code you wrote assumes there will always be two orders in each output file. If you ran a data file that had 1,179 unique records, your last output file would be named something like "1179_.pdf." To avoid that, you could make this slight modification: var name = [CurrentOrderNumber, NextOrderNumber].filter(String).join('_'); FusionPro.Composition.OpenNewOutputFile(name + "." + FusionPro.Composition.outputFormatExtension);
  21. Actually, you have 6 arrays. Each of your variables is assigned to an array. Let's take, for example, the array you've assigned to the 'UAArray' variable. If you want to put a dollar sign in front of the value of each of those fields you could just physically prepend it like this: var UAArray = [ [color="Red"]'$' + [/color]Field("UA Individual"), [color="Red"]'$' + [/color]Field("UATwo-Party"), [color="Red"]'$' + [/color]Field("UA Family") ]; Or you could use the map method: var UAArray = [ Field("UA Individual"), Field("UATwo-Party"), Field("UA Family") ][color="Red"].map(function(element){ return '$' + element; });[/color]
  22. Assuming you're asking because the value of 'x' is also a numeric value and you don't want the two values to be added together, you need to convert the two values to a string: return String(1) + String(23); // returns 123 If you had more than just two numbers you might find it easier to use an array: return [1,2,3].join(''); // returns 123
  23. You want to use the modulus operator: return CurrentRecordNumber() % 10000 || 10000;
  24. It seemed to me like your concern was editing the values that are displayed within a drop down menu. Being without the option to add a drop down menu to any of the templates I create in FusionPro, I assumed your question was specific to MarcomCentral. To answer your question as it relates to JavaScript: having a plus sign in a field value should not cause any problems because it's interpreted as a literal string.
  25. You should ask that question on the Marcom Central forum.
×
×
  • Create New...