#1
|
||||
|
||||
![]()
[SOLVED]
I am working on several items in this field including multiple possible body pages based on column value, overflow, and variable tables based on key customers and multi-row external data. My big issue right now is that my tables display on Preview but nothing shows up during Composition. I am assuming it is simple missed code or misplaced code on my behalf. OnRecordStart Code:
if (Field("MCE_Letter_Code") == "1") { FusionPro.Composition.SetBodyPageUsage("PP006", false); FusionPro.Composition.SetBodyPageUsage("PP006_2", false); FusionPro.Composition.SetBodyPageUsage("PP006_3", false); FusionPro.Composition.SetBodyPageUsage("PP006_Overflow",false); FusionPro.Composition.SetBodyPageUsage("PP009", false); FusionPro.Composition.SetBodyPageUsage("PP010", false); FusionPro.Composition.SetBodyPageUsage("PP026", false); } else if (Field("MCE_Letter_Code") == "6") { FusionPro.Composition.SetBodyPageUsage("PP001",false); FusionPro.Composition.SetBodyPageUsage("PP001_2",false); FusionPro.Composition.SetBodyPageUsage("PP001_Overflow",false); FusionPro.Composition.SetBodyPageUsage("PP009", false); FusionPro.Composition.SetBodyPageUsage("PP010", false); FusionPro.Composition.SetBodyPageUsage("PP026", false); } else if (Field("MCE_Letter_Code") == "9") { FusionPro.Composition.SetBodyPageUsage("PP001",false); FusionPro.Composition.SetBodyPageUsage("PP001_2",false); FusionPro.Composition.SetBodyPageUsage("PP001_Overflow",false); FusionPro.Composition.SetBodyPageUsage("PP006", false); FusionPro.Composition.SetBodyPageUsage("PP006_2", false); FusionPro.Composition.SetBodyPageUsage("PP006_3", false); FusionPro.Composition.SetBodyPageUsage("PP006_Overflow",false); FusionPro.Composition.SetBodyPageUsage("PP010", false); FusionPro.Composition.SetBodyPageUsage("PP026", false); } else if (Field("MCE_Letter_Code") == "10") { FusionPro.Composition.SetBodyPageUsage("PP001",false); FusionPro.Composition.SetBodyPageUsage("PP001_2",false); FusionPro.Composition.SetBodyPageUsage("PP001_Overflow",false); FusionPro.Composition.SetBodyPageUsage("PP006", false); FusionPro.Composition.SetBodyPageUsage("PP006_2", false); FusionPro.Composition.SetBodyPageUsage("PP006_3", false); FusionPro.Composition.SetBodyPageUsage("PP006_Overflow",false); FusionPro.Composition.SetBodyPageUsage("PP009", false); FusionPro.Composition.SetBodyPageUsage("PP026", false); } else if (Field("MCE_Letter_Code") == "26") { FusionPro.Composition.SetBodyPageUsage("PP001",false); FusionPro.Composition.SetBodyPageUsage("PP001_2",false); FusionPro.Composition.SetBodyPageUsage("PP001_Overflow",false); FusionPro.Composition.SetBodyPageUsage("PP006", false); FusionPro.Composition.SetBodyPageUsage("PP006_2", false); FusionPro.Composition.SetBodyPageUsage("PP006_3", false); FusionPro.Composition.SetBodyPageUsage("PP006_Overflow",false); FusionPro.Composition.SetBodyPageUsage("PP009", false); FusionPro.Composition.SetBodyPageUsage("PP010", false); } else { } return ""; Code:
//Link to the external data file. data = new ExternalDataFileEx("data_feed.csv", ","); if (!data.valid) { ReportError("Cannot successfully read/find the external data file."); } Code:
//The following if statement will detect if we are currently in preview mode or editing this rule (versus composing output). if(FusionPro.Composition.isPreview == true || FusionPro.inValidation == true) { Rule("OnJobStart"); } //Create empty var table = []; var tbl = []; //Get a count of the total number of records in the external data file NumberOfRecords = data.recordCount; var type = [ [' '] //Header ]; //Create Table var myTable = new FPTable; myTable.AddColumns(13000, 2000, 20000, 8500, 6500); tbl.push(["", "", "Provider Name", "Phone Number", "Miles Away"]); //Header Rows //Now, loop through all records in the external data file and find the records for (var n=1; n<=NumberOfRecords; n++) { function ExField(field) {return data.GetFieldValue(n, field);} if (Field("MCE_Case_Number") == ExField("Case_Number")) { type.forEach(function(s) { var [provider, phone, miles] = s; provider = ExField("Prov_Name"); phone = ExField("Prov_Phone").replace(/^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})$/, "($1) $2-$3"); miles = FormatNumber("0.0", ExField("Prov_Mileage")/100); tbl.push(['Check to choose this provider', '', provider, phone, miles]); }); } } // Formatting for (var i=0; i<tbl.length; i++) { var row = myTable.AddRow(); var cell = row.Cells[0]; row.minHeight = 2000; cell.Margins = new FPTableMargins; cell.Margins.Bottom = 0; row.CopyCells (0,1,2,3,4); if (i >= 1) myTable.Rows[i].Cells[1].SetBorders ("Thin", "Black", "Top", "Bottom", "Right", "Left"); if (i == 0) cell.HStraddle = 2; myTable.Rows[0].Cells[1].Bold = "On"; cell.VAlign = "Middle"; row.CopyCells (1,2,3,4); myTable.Rows[i].Cells[2].HAlign = "Left"; myTable.Rows[i].Cells[3].HAlign = "Center"; myTable.Rows[i].Cells[4].HAlign = "Right"; var [col0, col1, col2, col3, col4] = tbl[i]; row.SetContents (col0, col1, col2, col3, col4); } myTable.AddRow(1); //Blank row for seperation //Push variable into Array table.push(myTable.MakeTags()); return table; Code:
If you want a doctor not listed in the chart below, write the name and city on the lines below. Name: City: «Rule_DataTable» Person completing this form: Suggestions? Another set of eyes on my code helps a lot.
__________________
Audra Landis Computer Systems Admin VDP Producer v10.0.3 Windows 7 / Windows 10 Acrobat Pro DC (2015.010.20056) Last edited by Landisa; November 10th, 2016 at 10:45 AM.. Reason: Solved |
#2
|
||||
|
||||
![]()
Are you getting any errors in your message log? Like: "Cannot successfully read/find the external data file."?
You could try just defining your data file within the rule itself rather than assigning it to a global variable in OnJobStart: Code:
//Link to the external data file. data = new ExternalDataFileEx("data_feed.csv", ","); if (!data.valid) { ReportError("Cannot successfully read/find the external data file."); } //Create empty var table = []; var tbl = []; //Get a count of the total number of records in the external data file NumberOfRecords = data.recordCount; var type = [ [' '] //Header ]; //Create Table var myTable = new FPTable; myTable.AddColumns(13000, 2000, 20000, 8500, 6500); tbl.push(["", "", "Provider Name", "Phone Number", "Miles Away"]); //Header Rows //Now, loop through all records in the external data file and find the records for (var n=1; n<=NumberOfRecords; n++) { function ExField(field) {return data.GetFieldValue(n, field);} if (Field("MCE_Case_Number") == ExField("Case_Number")) { type.forEach(function(s) { var [provider, phone, miles] = s; provider = ExField("Prov_Name"); phone = ExField("Prov_Phone").replace(/^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})$/, "($1) $2-$3"); miles = FormatNumber("0.0", ExField("Prov_Mileage")/100); tbl.push(['Check to choose this provider', '', provider, phone, miles]); }); } } // Formatting for (var i=0; i<tbl.length; i++) { var row = myTable.AddRow(); var cell = row.Cells[0]; row.minHeight = 2000; cell.Margins = new FPTableMargins; cell.Margins.Bottom = 0; row.CopyCells (0,1,2,3,4); if (i >= 1) myTable.Rows[i].Cells[1].SetBorders ("Thin", "Black", "Top", "Bottom", "Right", "Left"); if (i == 0) cell.HStraddle = 2; myTable.Rows[0].Cells[1].Bold = "On"; cell.VAlign = "Middle"; row.CopyCells (1,2,3,4); myTable.Rows[i].Cells[2].HAlign = "Left"; myTable.Rows[i].Cells[3].HAlign = "Center"; myTable.Rows[i].Cells[4].HAlign = "Right"; var [col0, col1, col2, col3, col4] = tbl[i]; row.SetContents (col0, col1, col2, col3, col4); } myTable.AddRow(1); //Blank row for seperation //Push variable into Array table.push(myTable.MakeTags()); return table;
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 |
#3
|
||||
|
||||
![]() Quote:
As for the Message Log, I have no idea where to find it. I will go looking for it.
__________________
Audra Landis Computer Systems Admin VDP Producer v10.0.3 Windows 7 / Windows 10 Acrobat Pro DC (2015.010.20056) |
#4
|
||||
|
||||
![]()
No errors were found on composition.
Code:
====================SUMMARY==================== Collection Directory: C:\Users\AppData\Local\Temp\ ------------------ Composition files: C:\Users\Desktop\FusionPro\Passport Letter_FPro.pdf C:\Users\Desktop\FusionPro\caseworkers.csv Graphics resource files copied: 0 ------------------ Text resource files copied: 0 ------------------ Page media files copied: 0 ------------------ Imposition files copied: 0 ------------------ ------------------ ------------------ ------------------ ------------------ ------------------ Following files are generated for server composition after collect. Data Definition File: Passport Letter_FPro.def DIF format file: Passport Letter_FPro.dif Configuration File: Passport Letter_FPro-o.cfg Unicode Font Files: 4 C:\Users\Public\Documents\PTI\FusionPro\Fonts\Arial Italic-1.pfa C:\Users\Public\Documents\PTI\FusionPro\Fonts\Arial Bold Italic-1.pfa C:\Users\Public\Documents\PTI\FusionPro\Fonts\Arial Bold-1.pfa C:\Users\Public\Documents\PTI\FusionPro\Fonts\Arial-1.pfa
__________________
Audra Landis Computer Systems Admin VDP Producer v10.0.3 Windows 7 / Windows 10 Acrobat Pro DC (2015.010.20056) |
#5
|
||||
|
||||
![]()
That isn't the composition log; that is the collection log. The composition log would likely be in the same place as your composed output file.
Are you composing the output on a different machine than the one you're using to preview the template? I still think that the issue is that your template can't find your external data file at the time of composition. You can try adding an absolute path to your external data file: Code:
data = new ExternalDataFileEx("C:\Users\Desktop\FusionPro\data_feed.csv", ",");
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 |
#6
|
||||
|
||||
![]() Quote:
Once I did that the composition worked! *facepalm* Yes, I am previewing the document on a separate machine then composition. Problem Solved!
__________________
Audra Landis Computer Systems Admin VDP Producer v10.0.3 Windows 7 / Windows 10 Acrobat Pro DC (2015.010.20056) |
#7
|
||||
|
||||
![]() Quote:
Code:
data = new ExternalDataFileEx("C:\\Users\\Desktop\\FusionPro\\data_feed.csv", ","); Code:
data = new ExternalDataFileEx("C:/Users/Desktop/FusionPro/data_feed.csv", ","); Code:
data = new ExternalDataFileEx("\\\\fileserver\\share\\subfolder\\etc\\data_feed.csv", ","); Quote:
Having said all of that, though, I think the easiest solution is to add the external data file data_feed.csv to the template as a text resource. Then it will get collected up with the job when it's submitted to Producer for composition, and will be found at composition time without having to specify a full path anywhere.
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com. Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs. This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data. Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages. Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance. Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support. How To Ask Questions The Smart Way The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript. Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5. return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)}); ![]() |
#8
|
||||
|
||||
![]()
Attached File
__________________
Audra Landis Computer Systems Admin VDP Producer v10.0.3 Windows 7 / Windows 10 Acrobat Pro DC (2015.010.20056) |
![]() |
Tags |
composition, display, table, variable |
Thread Tools | Search this Thread |
Display Modes | |
|
|