Go Back   PTI Marketing Technologies User Community > Support > Issues, Questions, Etc.

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 29th, 2018, 01:52 PM
Kal's Avatar
Kal Kal is offline
Regular Contributor
 
Join Date: Jun 2011
Location: Canada
Posts: 52
Default Output to multiple files - stay unique

I'm outputting to multiple files based on a Data field "AccountNo".

Problem is I can have 2 or more people with the same accountNo that live in the same location.

So is there a way to keep it unique and not overwrite itself.

Maybe add a "_1 or _2 or _3" depending on how many times the same account number comes up.

FusionPro.Composition.outputFileName = Field("AccountNo") + ".pdf";
__________________
Kal Bedi
FusionPro Desktop 10.0.16
Adobe Acrobat Pro DC
Mac OS Sierra 10.12.5
Canada
Reply With Quote
  #2  
Old January 29th, 2018, 04:52 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 936
Default Re: Output to multiple files - stay unique

You could do it by tracking how many times each account number has been used by adding them to a global object:
JavaScript Globals
Code:
var accounts = {};
OnRecordStart
Code:
var FP = FusionPro.Composition;
var accountNumber = Field('AccountNo');
if (!accounts[accountNumber]) {
  accounts[accountNumber] = 1;
} else {
  accountNumber += '_' + ++accounts[accountNumber];
}
FP.OpenNewOutputFile(accountNumber + '.' + FP.outputFormatExtension);
__________________
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 09:15 AM.


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