Kal Posted January 29, 2018 Share Posted January 29, 2018 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"; Quote Link to comment Share on other sites More sharing options...
step Posted January 29, 2018 Share Posted January 29, 2018 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 = {}; OnRecordStart var FP = FusionPro.Composition; var accountNumber = Field('AccountNo'); if (!accounts[accountNumber]) { accounts[accountNumber] = 1; } else { accountNumber += '_' + ++accounts[accountNumber]; } FP.OpenNewOutputFile(accountNumber + '.' + FP.outputFormatExtension); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.