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

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old January 14th, 2016, 08:31 AM
MarkJonesEMKT MarkJonesEMKT is offline
Junior Community Member
 
Join Date: Dec 2015
Location: Virgina
Posts: 17
Default Re: Access Job Options in OnNewOutputFile Rule

Quote:
What is the purpose of the "boolflag" variable? Are you including that as some sort of exit status for the function? If so, that's not necessary. If you're using it to determine whether the job is being chunked or not, as I said in my other post, you can determine that based on the "chunkSize" variable.
The boolflag is an external "global variable," I used it so that my "output2" naming convention would only get called once, and would not get called when I was using the "output1" naming convention. I could have used "chunkSize", but then I would have had to check another flag anyway which is why I chose not to handle it like that.

Quote:
The correct way to access the input file's name is FusionPro.Composition.inputFileName. FusionPro.inputFileName will not return anything and your "outputName2" will end in a trailing underscore (_) as a result. Using the "building blocks" will allow you to access the properties of the FusionPro object as well as give a description. From the Building Blocks, click Objects > FusionPro (Global) > Composition > Input and Output > inputFileName. Double-clicking on the "inputFileName" will insert it into your rule editor.
This is actually what I thought too, however "FusionPro.Composition.inputFileName" returns null while "FusionPro.inputFileName" returns the correct naming convention. I actually used the building blocks to double check and it added it as "FusionPro.inputFileName"

Quote:
To handle that scenario, you'd have to force FusionPro to preprocess the job by putting this in an "OnJobStart" callback: ....
Thank you for this! I was actually looking into how I could accomplish this.
Reply With Quote
  #12  
Old January 14th, 2016, 09:08 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Access Job Options in OnNewOutputFile Rule

Quote:
Originally Posted by MarkJonesEMKT View Post
The boolflag is an external "global variable," I used it so that my "output2" naming convention would only get called once, and would not get called when I was using the "output1" naming convention. I could have used "chunkSize", but then I would have had to check another flag anyway which is why I chose not to handle it like that.
Okay, I think I understand what you're saying. That's basically what I was doing by opening a new output file at the start of a chunk or the first record in the data file.

Quote:
Originally Posted by MarkJonesEMKT View Post
This is actually what I thought too, however "FusionPro.Composition.inputFileName" returns null while "FusionPro.inputFileName" returns the correct naming convention. I actually used the building blocks to double check and it added it as "FusionPro.inputFileName"
Okay, if you say so. I don't know what version of FusionPro you have installed but I'm running version 8 and as of version 8 the input file is accessed by FusionPro.Composition.inputFileName just as it's inserted by the "Building Blocks." I'm not saying that they couldn't have changed it in later versions of the software but that seems like something that would have disrupted existing templates that relied on that property. And you'll have to be a little more specific when you say it "returns null" or "returns the correct naming convention." Do you mean in validation or preview? Or are you actually composing the file to see if it's been named like you'd expect? The template can't return the name of the input file until the file is being composed so you'd need to compose the job to check the naming convention.
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #13  
Old January 14th, 2016, 10:25 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,504
Default Re: Access Job Options in OnNewOutputFile Rule

Quote:
Originally Posted by step View Post
Okay, if you say so. I don't know what version of FusionPro you have installed but I'm running version 8 and as of version 8 the input file is accessed by FusionPro.Composition.inputFileName just as it's inserted by the "Building Blocks." I'm not saying that they couldn't have changed it in later versions of the software but that seems like something that would have disrupted existing templates that relied on that property. And you'll have to be a little more specific when you say it "returns null" or "returns the correct naming convention." Do you mean in validation or preview? Or are you actually composing the file to see if it's been named like you'd expect? The template can't return the name of the input file until the file is being composed so you'd need to compose the job to check the naming convention.
As of FusionPro VDP version 9.2, both FusionPro.Composition.inputFileName and FusionPro.inputFileName are valid properties. But they're not exactly the same, and it's important to understand the differences:
  • FusionPro.inputFileName returns the input data file name from the data definition, as specified at template design time in FP VDP Creator in Acrobat. At rule validation time, in the Rule Editor, this returns the input file path and name, if any. (It can still return an empty string if the input type is "None".) At composition time, this may not be the actual data file being processed.
  • FusionPro.Composition.inputFileName returns path and name of the data file actually being processed in a FusionPro Server, Producer, or Creator composition, at composition time. This is usually different than the input file specified at template design time. At rule validation time, in the Rule Editor, this always returns an empty string. (This is the same as the rest of the FusionPro.Composition properties, which do not return anything meaningful at rule validation time, since there isn't actually a composition occurring.) Note that this property works exactly the same way as in previous versions of FusionPro.
There's also a new helper function PrimaryInputFile(), which (except in the case of "None" input) returns an appropriate file path and name at both rule validation and composition time. This was added to aid in creating rules such as the one in this thread, where you need to have a file name to validate the rule in the editor, but you also need to deal with the actual data file being composed at composition time.

So in FusionPro 9.2 or later, I would recommend using the PrimaryInputFile() function instead of either the FusionPro.Composition.inputFileName or FusionPro.inputFileName properties.
__________________
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
  #14  
Old January 14th, 2016, 11:07 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Access Job Options in OnNewOutputFile Rule

Quote:
Originally Posted by Dan Korn View Post
There's also a new helper function PrimaryInputFile(), which (except in the case of "None" input) returns an appropriate file path and name at both rule validation and composition time. This was added to aid in creating rules such as the one in this thread, where you need to have a file name to validate the rule in the editor, but you also need to deal with the actual data file being composed at composition time.
Oh, that's definitely useful! Thanks for the clarification, Dan. I will (finally) be switching over to FP9 next week so I won't have to keep hypothesizing about all of its features
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
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 07:06 AM.


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