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 December 19th, 2012, 02:11 PM
KatJones KatJones is offline
Junior Community Member
 
Join Date: Sep 2011
Location: Atlanta, GA
Posts: 22
Question File output records based on data field

Here is the details:
I have 1 large data file. Within that data file I have 20 versions. Each version has different quantities.

The problem:
I need to output SEPARATE .pdfs based on each version... with each each PDF named what version it is tagged to.

Example:
A01 has 33214 records
A02 has 26102 records...etc.

I need a PDF named A01.pdf that has 33214 records, and I will need another PDF named A02.pdf with 26102 records and so on....

I am certain there is a callback rule that can be created, but my javascript/script writing skills is minimal to none.
Reply With Quote
  #2  
Old December 19th, 2012, 02:17 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,359
Default Re: File output records based on data field

In OnRecordStart:
Code:
if (FieldChanged("YourFieldName"))
    FusionPro.Composition.OpenNewOutputFile(Field("YourFieldName") +
        "." + FusionPro.Composition.outputFormatExtension);
__________________
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 December 19th, 2012, 02:30 PM
KatJones KatJones is offline
Junior Community Member
 
Join Date: Sep 2011
Location: Atlanta, GA
Posts: 22
Default Re: File output records based on data field

Quote:
Originally Posted by Dan Korn View Post
In OnRecordStart:
Code:
if (FieldChanged("YourFieldName"))
    FusionPro.Composition.OpenNewOutputFile(Field("YourFieldName") +
        "." + FusionPro.Composition.outputFormatExtension);
It says that the FieldChange is not defined once I changed the "yourfieldname".
Reply With Quote
  #4  
Old December 19th, 2012, 02:51 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,359
Default Re: File output records based on data field

Quote:
Originally Posted by KatJones View Post
It says that the FieldChange is not defined once I changed the "yourfieldname".
Sorry, you didn't say what version of FusionPro you're using. This requires FusionPro 8.
__________________
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 December 19th, 2012, 02:54 PM
KatJones KatJones is offline
Junior Community Member
 
Join Date: Sep 2011
Location: Atlanta, GA
Posts: 22
Default Re: File output records based on data field

Ah! I believe that may be the problem. We are operating on a older version of FusionPro. Is there a code for older versions? We are on 7.2
Reply With Quote
  #6  
Old December 19th, 2012, 03:00 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,359
Default Re: File output records based on data field

Quote:
Originally Posted by KatJones View Post
Ah! I believe that may be the problem. We are operating on a older version of FusionPro. Is there a code for older versions? We are on 7.2
No, the ability to compose to multiple output files, each of which contains a different number of output records (what we sometimes call "arbitrary chunking") is a new feature in FusionPro 8. It can't be done in 7.2. The only thing you can do with your version is to break up the input file and do multiple compositions.

In general, it's best to specify what version you're using when asking a question, as my signature notes.
__________________
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)});

Last edited by Dan Korn; December 19th, 2012 at 03:12 PM..
Reply With Quote
  #7  
Old March 25th, 2014, 01:37 PM
KatJones KatJones is offline
Junior Community Member
 
Join Date: Sep 2011
Location: Atlanta, GA
Posts: 22
Default Re: File output records based on data field

Hello,

Following back up on this. We now have upgraded to 9.1.0. On output do I need to check anything? Like the output to multiple files or anything. Im not seeing my files output as separate files based on the field change.

I should mention that I used an imposition file with this. Does that matter?
__________________
FP 9.1.0 Producer, Windows Server 2008 R2, Acrobat 10.1.9
Reply With Quote
  #8  
Old March 25th, 2014, 04:43 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,359
Default Re: File output records based on data field

Quote:
Originally Posted by KatJones View Post
Hello,

Following back up on this. We now have upgraded to 9.1.0. On output do I need to check anything? Like the output to multiple files or anything. Im not seeing my files output as separate files based on the field change.
The only thing you might need to do is turn off the "Output to multiple files" setting on the Output tab of the Composition Settings, if you had that checked. That sets "static chunking," where each output file (chunk) is the same number of records, but you're trying to use "dynamic chunking," where each output file has an arbitrary number of records. Generally, you want one or the other.
Quote:
Originally Posted by KatJones View Post
I should mention that I used an imposition file with this. Does that matter?
Yes, the imposition could be the problem. Are you doing stacked imposition? If so, then FusionPro wants to defer the chunk break (start of a new output file) until the next stack break (start of a new imposed stack) by default. You can modify this behavior by setting this in the OnJobStart rule:
Code:
FusionPro.Composition.chunksBreakStacks = true;
Although, before doing that, I would first disable imposition just to see if the chunking (multiple output files) is working the way you want without imposition.
__________________
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
  #9  
Old March 26th, 2014, 07:49 AM
KatJones KatJones is offline
Junior Community Member
 
Join Date: Sep 2011
Location: Atlanta, GA
Posts: 22
Default Re: File output records based on data field

I have tried this with imposition (infinite stack checked and without), without imposition. I didn't have the output to multiple files checked at all. It is still producing one output.

__________________
FP 9.1.0 Producer, Windows Server 2008 R2, Acrobat 10.1.9
Reply With Quote
  #10  
Old March 26th, 2014, 10:36 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,359
Default Re: File output records based on data field

Quote:
Originally Posted by KatJones View Post
I have tried this with imposition (infinite stack checked and without), without imposition. I didn't have the output to multiple files checked at all. It is still producing one output.
Okay, then maybe the rule is not written correctly. You are using some code similar to what I posted in your OnRecordStart rule, right? If you post the rule syntax here, I might be able to figure out what's wrong with it. Otherwise, I could just keep guessing, but my ESP isn't working well today.

You could always try something like this:
Code:
if (FieldChanged("<your field name>"))
    Print("The field changed!")
Then look in the composition log (.msg) file to see if that message is printed. If it's not, then you either have the wrong thing there in your "if" condition, or the field value is not actually changing.

Here is what the OnRecordStart rule would look like in the Cell Phone tutorial job installed with FusionPro:
Code:
if (FieldChanged("Lname"))
    FusionPro.Composition.OpenNewOutputFile(Field("LName") +
        "." + FusionPro.Composition.outputFormatExtension);
__________________
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

Tags
composition, javascript, output, records

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 12:58 PM.


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