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 8th, 2014, 11:48 AM
jwhittaker jwhittaker is offline
Senior Contributor
 
Join Date: Feb 2009
Location: San Diego
Posts: 169
Default Re: Outputing Multiple Files based on data

Mike
Just checking that you already made the folders in the path you are using. They have to be created by you because PTI can't make them yet.
I just noticed that I have a field that is unique to all records that is in the if (FieldChanged("Dealer Code")).
Do you have a field that is unique maybe the name field you can put in the
if (FieldChanged("Name")) instead of if (FieldChanged("WelcomePackageCode"))
Also you are using the \\ not // right?
__________________
FusionPro VDP Creator 10.0.26 | MacOS 10.13.4 | Acrobat DC
Reply With Quote
  #12  
Old January 9th, 2014, 12:05 PM
DCS DCS is offline
Junior Community Member
 
Join Date: Mar 2012
Posts: 13
Default Re: Outputing Multiple Files based on data

thanks for the help once again....

This is what I have and I am getting this error:
OnNewOutpuFile, Line 19: Syntax Error: missing ) after argument list

here is the code:

var str = ToLower(Field("WelcomePackageCode"));

if (str.search("74289NY0010001-01ONEC") != -1)
//outpath = "c:\Files\7-7 to Print\74289NY0010001-01ONEC\";
outpath = "c:\\Files\\7-7ToPrint\\" + Field("WelcomePackageCode") + "\\";

else if (str.search("74289NY0010001-01ONEE") != -1)
//outpath = "c:\Files\7-7 to Print\74289NY0010001-01ONEE\";
outpath = "c:\\ Files\\7-7ToPrint\\" + Field("WelcomePackageCode") + "\\";

else if (str.search("74289NY0010001-01ONES") != -1)
//outpath = "c:/Files/7-7 to Print/74289NY0010001-01ONES/";
outpath = "c:\\Files\\7-7ToPrint\\" + Field("WelcomePackageCode") + "\\";

else if (str.search("74289NY0010001-01ONFM") != -1)
//outpath = "c:/Files/7-7 to Print/74289NY0010001-01ONFM/";
outpath = "c:\\ Files\\7-7ToPrint\\" + Field("WelcomePackageCode") + "\\";

else if (str.search(74289NY0020001-01ONEC") != -1)
//outpath = "c:/Files/7-7 to Print/74289NY0020001-01ONEC/";
outpath = "c:\\Files\\7-7ToPrint\\" + Field("WelcomePackageCode") + "\\";

else if (str.search("74289NY0020001-01ONEE") != -1)
//outpath = "c:/Files/7-7 to Print/74289NY0020001-01ONEE/";
outpath = "c:\\Files\\7-7ToPrint\\" + Field("WelcomePackageCode") + "\\";

else if (str.search("74289NY0020001-01ONES") != -1)
//outpath = "c:/Files/7-7 to Print/74289NY0020001-01ONES/";
outpath = "c:\\Files\\7-7ToPrint\\" + Field("WelcomePackageCode") + "\\";

else if (str.search("74289NY0020001-01ONFM") != -1)
//outpath = "c:/Files/7-7 to Print/74289NY0020001-01ONFM/";
outpath = "c:\\Files\\7-7ToPrint\\" + Field("WelcomePackageCode") + "\\";


filename = Field("WelcomePackageCode") + " " + Field("LastNameRP") + "_" + Field("FirstNameRP") + " " + Field("SubscriberID");
outfile = outpath + filename;

if (FieldChanged("SNSTrackingID"))

FusionPro.Composition.OpenNewOutputFile(outfile + "." + FusionPro.Composition.outputFormatExtension);


Thanks
Mike
Reply With Quote
  #13  
Old January 9th, 2014, 12:29 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,671
Default Re: Outputing Multiple Files based on data

Well, the error message is telling you that the error is on line 19. You're missing a double quote. This line:
Code:
else if (str.search(74289NY0020001-01ONEC") != -1)
Should be this:
Code:
else if (str.search("74289NY0020001-01ONEC") != -1)
But I don't really understand why you have all those chained "if...else if" statements which all do exactly the same thing. Do you always want to do this?
Code:
outpath = "c:\\Files\\7-7ToPrint\\" + Field("WelcomePackageCode") + "\\";
If so, then just do that, unconditionally, without all the "if" statements. You can just get rid of lines 1 through 32, which reduces the entire rule to this:
Code:
outpath = "c:\\Files\\7-7ToPrint\\" + Field("WelcomePackageCode") + "\\";
filename = Field("WelcomePackageCode") + " " + Field("LastNameRP") + "_" + Field("FirstNameRP") + " " + Field("SubscriberID");
outfile = outpath + filename;

if (FieldChanged("SNSTrackingID"))
  FusionPro.Composition.OpenNewOutputFile(outfile + "." + FusionPro.Composition.outputFormatExtension);
Of course, the only condition you really care about here is "if (FieldChanged("SNSTrackingID"))", so I would just put everything in a block based on that condition, like so:
Code:
if (FieldChanged("SNSTrackingID"))
{
  outpath = "c:\\Files\\7-7ToPrint\\" + Field("WelcomePackageCode") + "\\";
  filename = Field("WelcomePackageCode") + " " + Field("LastNameRP") + "_" + Field("FirstNameRP") + " " + Field("SubscriberID");
  outfile = outpath + filename;
  FusionPro.Composition.OpenNewOutputFile(outfile + "." + FusionPro.Composition.outputFormatExtension);
}
Which of course can be reduced even further, to this:
Code:
if (FieldChanged("SNSTrackingID"))
    FusionPro.Composition.OpenNewOutputFile("c:\\Files\\7-7ToPrint\\" + Field("WelcomePackageCode") + "\\" +
        Field("WelcomePackageCode") + " " + Field("LastNameRP") + "_" + Field("FirstNameRP") + " " + Field("SubscriberID") +
        "." + 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
  #14  
Old January 9th, 2014, 03:25 PM
DCS DCS is offline
Junior Community Member
 
Join Date: Mar 2012
Posts: 13
Default Re: Outputing Multiple Files based on data

I've got 2 things to say 'bout that....

1. DOH!!!!
2. LOL


Mike
Reply With Quote
  #15  
Old January 23rd, 2014, 08:44 AM
DCS DCS is offline
Junior Community Member
 
Join Date: Mar 2012
Posts: 13
Default Re: Outputing Multiple Files based on data

Thanks for everyone's help on this....

One more question - Is there any way to tell FP to only use certain pages from the PDF. eg. pages 2-12

Thanks
Mike
Reply With Quote
  #16  
Old January 23rd, 2014, 10:12 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,671
Default Re: Outputing Multiple Files based on data

Quote:
Originally Posted by DCS View Post
One more question - Is there any way to tell FP to only use certain pages from the PDF. eg. pages 2-12
Yes. Search this forum for SetBodyPageUsage for lots of examples.
__________________
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 08:43 PM.


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