#1
|
|||
|
|||
![]()
Hi,
I have 44 data files that I'm pulling in one at a time into my template and composing only the first and last record of each for proof pdfs. I am going in and modifying the rule each time, changing the last record since they are all different record counts. I'm sure there's a way to automate this to make it less painful. Any help is appreciated. Code:
var ranges = [ 1, 225 ]; function CheckRanges(val) { for (var i in ranges) if (val == ranges[i] || ((ranges[i] instanceof Array) && val >= ranges[i][0] && val <= ranges[i][1])) return true; return false; } FusionPro.Composition.composeThisRecord = CheckRanges(CurrentRecordNumber()); return FusionPro.Composition.composeThisRecord; Lisa |
#2
|
|||
|
|||
![]()
Is that in an OnJobStart rule? I think you can assign a variable for a global data file object which uses your input data file. Then you count the total records and use that as your secondary element in var ranges:
Code:
myData = new ExternalDataFileEx(GetFileName(FusionPro.Composition.inputFileName), ",") //assuming CSV data totalRecords = myData.recordCount; var ranges = [ 1, totalRecords ]; // your function, etc. |
#3
|
||||
|
||||
![]()
Actually, as long as pre-processing is occurring, FusionPro already knows how many records there are. That information is accessible through "FusionPro.Composition.totalRecordCount".
If your job is imposing, then pre-processing is already occurring. Otherwise, you'll need to specifically tell the job to pre-process by putting this in an OnJobStart rule: Code:
FusionPro.Composition.forcePreprocessing = true; Code:
var ranges = [ 1, FusionPro.Composition.totalRecordCount ]; function CheckRanges(val) { for (var i in ranges) if (val == ranges[i] || ((ranges[i] instanceof Array) && val >= ranges[i][0] && val <= ranges[i][1])) return true; return false; } FusionPro.Composition.composeThisRecord = CheckRanges(CurrentRecordNumber()); Code:
FusionPro.Composition.composeThisRecord = [1,FusionPro.Composition.totalRecordCount].indexOf(CurrentRecordNumber()) > -1
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 |
#4
|
|||
|
|||
![]()
Eric,
Worked perfectly. Thank you so much! Lisa |
#5
|
|||
|
|||
![]()
Hi Ste,
I've already finished this job, however, I'm now trying your suggestions since they're a few less steps. Both of them are composing the first record (1) only. Any ideas? On Job Start Code:
FusionPro.Composition.forcePreprocessing = true; Code:
var ranges = [ 1, FusionPro.Composition.totalRecordCount ]; function CheckRanges(val) { for (var i in ranges) if (val == ranges[i] || ((ranges[i] instanceof Array) && val >= ranges[i][0] && val <= ranges[i][1])) return true; return false; } FusionPro.Composition.composeThisRecord = CheckRanges(CurrentRecordNumber()); Thanks Lisa |
#6
|
||||
|
||||
![]() Quote:
Code:
Print("FusionPro.Composition.totalRecordCount=" + FusionPro.Composition.totalRecordCount); Print("CurrentRecordNumber()=" + CurrentRecordNumber()); Print("FusionPro.Composition.composeThisRecord=" + FusionPro.Composition.composeThisRecord);
__________________
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)}); ![]() |
#7
|
|||
|
|||
![]()
Hi Dan,
Thanks for getting back to me. I added the calls you suggested and I can see that the "totalRecordCount" is showing 0 in the msg file. I'm attaching the msg file for you to take a look at if you wouldn't mind. Thanks Lisa |
#8
|
||||
|
||||
![]()
Sorry, Lisa, I should have given that a try before I posted it as a solution. I think what's happening is that OnRecordStart is being called during pre-processing to determine the total number of records that will be generated. Since the range is set to "1" and "totalRecords" (which is unknown at the time of pre-processing), pre-processing will determine that only one record will be created thus making the total records 1. You'd have to add the following to tell pre-processing that all records should be composed when you're pre-processing the job so that the totalRecordCount is accurate:
Code:
var ranges = [ 1, FusionPro.Composition.totalRecordCount ]; function CheckRanges(val) { for (var i in ranges) if (val == ranges[i] || ((ranges[i] instanceof Array) && val >= ranges[i][0] && val <= ranges[i][1])) return true; return false; } FusionPro.Composition.composeThisRecord = FusionPro.Composition.inPreprocessing || CheckRanges(CurrentRecordNumber()); Code:
this.total = this.total || 0; if (FusionPro.Composition.inPreprocessing) ++this.total; var ranges = [ 1, this.total ]; function CheckRanges(val) { for (var i in ranges) if (val == ranges[i] || ((ranges[i] instanceof Array) && val >= ranges[i][0] && val <= ranges[i][1])) return true; return false; } FusionPro.Composition.composeThisRecord = CheckRanges(CurrentRecordNumber());
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 |
#9
|
||||
|
||||
![]()
Okay, I see what's happening. The thing is, when you do preprocessing, the preprocessing pass figures out which records to compose ahead of time, generally for figuring out imposition stacking. So records that are skipped (composeThisRecord = false) at preprocessing are not included in the totalRecordCount. Therefore, you need to tell FusionPro to skip records only during the main composition pass, not during preprocessing. The easiest way to do that for this case is like so:
Code:
FusionPro.Composition.composeThisRecord = FusionPro.Composition.inPreprocessing || [1,FusionPro.Composition.totalRecordCount].indexOf(CurrentRecordNumber()) > -1;
__________________
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)}); ![]() |
#10
|
|||
|
|||
![]()
Dan,
That worked perfectly. Thanks again for all your help. Lisa |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|