Go Back   MarcomCentral (PTI) and FusionPro User Communities > Support > Issues, Questions, Etc.


Thread Tools Search this Thread Display Modes
Old January 29th, 2018, 01:52 PM
Kal's Avatar
Kal Kal is offline
Regular Contributor
Join Date: Jun 2011
Location: Canada
Posts: 56
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.1.9
Adobe Acrobat Pro DC
Mac OS Sierra 10.12.5
Reply With Quote
Old January 29th, 2018, 04:52 PM
step's Avatar
step step is offline
Senior Contributor
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 957
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
var accounts = {};
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

Reply With Quote

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 03:41 AM.

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