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 January 6th, 2014, 02:28 PM
DCS DCS is offline
Junior Community Member
 
Join Date: Mar 2012
Posts: 13
Default Outputing Multiple Files based on data

k... here goes....

Using 9.1 Windows

We have a project that need to output multiple files based on a specific data field. I have accomplished that with PTI's help. What I am wondering is this.

I have a data file with 760 names, addresses and other misc data. There is a field named "Plan" which changes from person to person. There are 100 different data strings that can possibly be assigned to each person's "plan". I have sorted the data so it is in order of the "plan" field (so the first 51 have the same plan , the next 32 have the same plan, etc.)

On output is it possible to tell FP to create a folder named whatever is in the "plan" field and create multiple pdfs within that folder? When it finishes that bunch of 51, create a new folder named the next "plan" and output it's files.

Sorry so long and winded, but any help would be appreciated

Thanks
Mike
Reply With Quote
  #2  
Old January 7th, 2014, 09:11 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
On output is it possible to tell FP to create a folder named whatever is in the "plan" field and create multiple pdfs within that folder? When it finishes that bunch of 51, create a new folder named the next "plan" and output it's files.
Not with FusionPro 9.1, no. However, we are adding this functionality to FusionPro 9.2.
__________________
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 January 7th, 2014, 10:15 AM
DCS DCS is offline
Junior Community Member
 
Join Date: Mar 2012
Posts: 13
Default Re: Outputing Multiple Files based on data

Great!!

When could we expect to see 9.2?
Reply With Quote
  #4  
Old January 7th, 2014, 10:45 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
When could we expect to see 9.2?
I don't have any release date for you, but we're working on it. My best guess (although this isn't official) is by the end of this quarter.
__________________
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 January 7th, 2014, 01:42 PM
jwhittaker jwhittaker is offline
Senior Contributor
 
Join Date: Feb 2009
Location: San Diego
Posts: 169
Default Re: Outputing Multiple Files based on data

Mike
I have a job I do every 4 months or so and it's kind of like this. I have changed some of the code to make it more like your example.
My output folders are always the same names so I made a folder on my desktop called AllPlans and then made sub folders called Plan1, Plan2, Plan3, etc
You could then search your Plan field for the correct file location and then name the output file with the plan and name.

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

if (str.search("plan1") != -1)
outpath = "/Users/MacPro/Desktop/AllPlans/Plan1/";

else if (str.search("plan2") != -1)
outpath = "/Users/MacPro/Desktop/AllPlans/Plan2/";

else if (str.search("plan3") != -1)
outpath = "/Users/MacPro/Desktop/AllPlans/Plan3/";

else if (str.search("plan4") != -1)
outpath = "/Users/MacPro/Desktop/AllPlans/Plan4/";


filename = Str(Field("Plan") + "-" + Field("Name"));
outfile = outpath + filename;

if (FieldChanged("Plan"))

FusionPro.Composition.OpenNewOutputFile(outfile + "." + FusionPro.Composition.outputFormatExtension);
__________________
FusionPro VDP Creator 10.0.26 | MacOS 10.13.4 | Acrobat DC
Reply With Quote
  #6  
Old January 7th, 2014, 02:54 PM
DCS DCS is offline
Junior Community Member
 
Join Date: Mar 2012
Posts: 13
Default Re: Outputing Multiple Files based on data

Thanks Jon, I will give it a try
Reply With Quote
  #7  
Old January 7th, 2014, 03:28 PM
DCS DCS is offline
Junior Community Member
 
Join Date: Mar 2012
Posts: 13
Default Re: Outputing Multiple Files based on data

This is what i got... I am getting errors
I think it has to do with my path

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

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

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

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

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

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

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

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

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


filename = Str(Field("WelcomePackageCode") + " " + Field("LastnameRP") + "_" +
Field("firstnameRP") + " " + Field("SubscriberID"));
outfile = outpath + filename;

if (FieldChanged("WelcomePackageCode"))

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

Last edited by DCS; January 7th, 2014 at 03:43 PM..
Reply With Quote
  #8  
Old January 8th, 2014, 07:00 AM
jwhittaker jwhittaker is offline
Senior Contributor
 
Join Date: Feb 2009
Location: San Diego
Posts: 169
Default Re: Outputing Multiple Files based on data

What are the error messages?
I work on a mac and it's a little different than a pc. I know I had a problem with the number of chars in the length of the path. I also didn't use any special chars. One thing is that when I assign the data to the str variable I made it to lower case and you are search for uppercase. Another thing Dan Corn said somewhere is to put in \\ instead of single \ in the path but he also said you could put forward slashes to / instead. Just giving you some options to try.

outpath = "c:\\Files\\7-7 to Print\\74289NY0010001-01ONES\\";
__________________
FusionPro VDP Creator 10.0.26 | MacOS 10.13.4 | Acrobat DC
Reply With Quote
  #9  
Old January 8th, 2014, 08:00 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 957
Default Re: Outputing Multiple Files based on data

Couple of issues I see here. First, you are setting the value of the "WelcomePackageCode" to all lowercase and then searching it for uppercase letters. Secondly, I think you also need to escape spaces in your path. I think you could simplify your code to look like this:

Code:
outpath = "c:\\Files\\7-7\ to\ Print\\" + Field("WelcomePackageCode") + "\\";
filename = Field("WelcomePackageCode") + " " + Field("LastnameRP") + "_" + Field("firstnameRP") + " " + Field("SubscriberID");
outfile = outpath + filename;

if (FieldChanged("WelcomePackageCode"))
    FusionPro.Composition.OpenNewOutputFile(outfile + "." + FusionPro.Composition.outputFormatExtension);
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #10  
Old January 8th, 2014, 08:16 AM
DCS DCS is offline
Junior Community Member
 
Join Date: Mar 2012
Posts: 13
Default Re: Outputing Multiple Files based on data

Thanks Guys for all the help...
was playing around late into the night...
(obviously I am a complete noob to this)

couple of issues....

1. I get it to make a file named properly but only the first one of the "plan"
the rest just get named 1.pdf, 2.pdf , etc.

2. I can't seem to get the composed files into their proper folders. They are being made in my directory that the original PDF is in, even after I code the "//"

Thanks Again
Mike
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:45 PM.


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