Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 2nd, 2011, 08:18 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Count Records

Is "countRecords" limited to only external data files? I have a job that I would like to count the number of records of my internal data file on an OnJobStart rule but the following code doesn't yield any results when I run a Print line command:

Code:
var rec = FusionPro.Composition.recordCount;
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #2  
Old August 2nd, 2011, 01:07 PM
Dan Korn's Avatar
Dan Korn Dan Korn is online now
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,367
Default Re: Count Records

Quote:
Originally Posted by step View Post
Is "countRecords" limited to only external data files? I have a job that I would like to count the number of records of my internal data file on an OnJobStart rule but the following code doesn't yield any results when I run a Print line command:

Code:
var rec = FusionPro.Composition.recordCount;
That's not a valid property of the FusionPro.Composition object.

No, there's nothing built-in to count the number of records in your main data file before the composition starts. And the actual number of lines in the data file isn't necessarily the same as the number of records you're going to compose anyway, because you might be skipping or repeating records.

You could, of course, load your main input data file (if it's a delimited "flat" data file and not tagged) with ExternalDataFileEx and count the records that way. But you need to know the delimiter in the rule.

What are you trying to do with the number of records?
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

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)});
Reply With Quote
  #3  
Old August 3rd, 2011, 07:01 AM
esmith's Avatar
esmith esmith is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Charlotte, NC
Posts: 870
Default Re: Count Records

I admit that I find it odd that there's not a way to count records in the primary data file. Doesn't FP have to do this during composition when imposing with a stacked layout? Why treat primary data differently than external data?
__________________
Eric Smith
Content Developer
Classic
FP 9.3.6, MAC OSX 10.9.4, Acrobat 11.0.09
Reply With Quote
  #4  
Old August 3rd, 2011, 10:04 AM
Dan Korn's Avatar
Dan Korn Dan Korn is online now
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,367
Default Re: Count Records

Quote:
Originally Posted by esmith View Post
I admit that I find it odd that there's not a way to count records in the primary data file. Doesn't FP have to do this during composition when imposing with a stacked layout?
Yes, FusionPro does a preprocessing step to determine the total number of records for "infinite" stacking (and for personalized images). But that's not exposed via JavaScript, and even if it was, that would only apply to jobs with doing this preprocessing step. And again, it's not about the number of records in the data file, it's about the number or records that are actually composed, taking skips and repeats into account.

Also, preprocessing can greatly slow down the composition, especially for larger jobs with tens or hundreds of thousands of records, since it has to read the entire data file twice. The regular way that FusionPro works, without preprocessing, is that it just reads the input data file and composes output records as it reads them in, until it gets to the end. (It looks at the size of the file and how far along it is in reading it in bytes to estimate the total number of records during composition, but getting the file size is a lot faster than reading the whole file in a preprocessing step.)

Perhaps there could be an option, exposed to JavaScript, which forces preprocessing, then returns the total number of records to be composed. We're actually considering this for a future release. Again, though, it would help to focus the enhancement request, or I might be able to suggest something else, if I knew exactly what the ultimate goal was.
Quote:
Originally Posted by esmith View Post
Why treat primary data differently than external data?
These files are treated differently by definition. The primary data file is what drives the composition and largely determines the number of records being composed, and their order. The external data file API in JavaScript, however, simply exposes a way to randomly access a delimited data file. FusionPro has no knowledge of how you're going to use the data in the file; that's up to whatever JavaScript logic you write. So how you treat the secondary data file is up to you, not to FusionPro.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

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)});
Reply With Quote
  #5  
Old August 4th, 2011, 09:25 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Count Records

Quote:
Originally Posted by Dan Korn View Post
Perhaps there could be an option, exposed to JavaScript, which forces preprocessing, then returns the total number of records to be composed. We're actually considering this for a future release. Again, though, it would help to focus the enhancement request, or I might be able to suggest something else, if I knew exactly what the ultimate goal was.
I was attempting to create some what of a work-around for the problem I was discussing here. I created a script that would determine an imposition of best fit for a particular order of business cards based on the number of unique cards (records). I did this by bringing the internal data file in as an external data file.

Since I can't get FusionPro to call FPI files based on that information, I just appended it to the end of the file name (24up) and that let's me know that I need to drop the non-imposed PDFs into a hot folder with an applied imposition at our Indigo press.
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #6  
Old August 4th, 2011, 10:06 AM
Dan Korn's Avatar
Dan Korn Dan Korn is online now
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,367
Default Re: Count Records

Quote:
Originally Posted by step View Post
I was attempting to create some what of a work-around for the problem I was discussing here.
I'll reply in that other thread about imposition specifically.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

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)});
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:52 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.