Rick J. Posted October 25, 2017 Posted October 25, 2017 (edited) I have a project where I need to list all the donations from each donor onto one or more pages. The name and address can only appear on the first page and I have that working. The Total gift amount can only appear at the end of the list of donations (weather that is on a single sheet or at the end of multiple pages) that part is not working. Also, I’m bringing back the donations, but it is bringing back all the donations for each record on each record on its own page. I can fit up to (but no more than) 32 lines of data in my “Donations” text box. The maximum lines on one sheet would be 30 separate donations, one space and the Total Gift Amount. If we have 31 or 32 donations the Total Gift Amount would be the only line on the second page. My donations text boxes take care of the amount of data that appears on each page. What I’m trying to do with the rule “ListOfDonations” is make an external copy of my input file and as long as the DonorID field match between the external and the input file, it should bring back the data for that donor. Right now, the pdf never gets created because there is something wrong with my code on the count. It gets to the end of the list and the estimated page count goes to 9300 something. I just have to stop composing at this point. The output should be as follows: DonorID 1 - 1 page with one gift with total. DonorID 2 - 2 pages. First page full, second page half full with total. DonorID 3 - 1 page full with total. DonorID 4 - 1 page with 5 gifts and total. DonorID 5 - 2 pages. first page full (32 lines of data) and second page with the Total only. The pdf should be 7 pages total. I’m attaching a zip of my project. Any help is appreciated. Thanks, Rick J. FusionPro VDP Creator 9.3.36 Adobe Acrobat XI Mac OS X Yosemite Version 10.10.5FP_YES_Test.zip Edited October 25, 2017 by Rick J. Quote
Dan Korn Posted October 25, 2017 Posted October 25, 2017 This is really easy to do with the new multi-line record feature in FusionPro VDP 10. All you have to do is check the "Multi-line records" box in the Data Source Wizard, then you get another screen where you can specify the condition where the main record changes (which in the case would already be set to the default, which is when the first field value changes). Then you call the FusionPro.GetMultiLineRecords() function in a rule to get an ExternalDataFileEx object containing the lines of data for the record, and iterate through those records. Quote: Quote
Rick J. Posted October 25, 2017 Author Posted October 25, 2017 Sorry Dan. When I typed my version of Fusion Pro it is 9.3.36 not version 10. Quote
Dan Korn Posted October 25, 2017 Posted October 25, 2017 Sorry Dan. When I typed my version of Fusion Pro it is 9.3.36 not version 10. Yes, I understand, you're using version 9.3 now. Version 10 has a new feature that does exactly what you need. Quote
Rick J. Posted October 26, 2017 Author Posted October 26, 2017 Any way to get this done in Version 9.3.36? I'm not seeing getting version 10 any time soon. Quote
step Posted October 26, 2017 Posted October 26, 2017 Any way to get this done in Version 9.3.36? I'm not seeing getting version 10 any time soon. This is how I would do it: First, you need to remove all of the content from your overflow frame ("Donations2") on page two. That frame will be populated by "Donations1" if the text doesn't fit. Since you're querying your data file for all records of the same "DonorID," once a particular donor ID has been processed, it's safe to assume all subsequent records of the same donor ID have already been composed. So, you need to tell FusionPro to only compose a record when the "DonorID" changes so that you end up with seven composed records rather than 114. You can do that by creating a "OnRecordStart" callback rule and adding this line: FusionPro.Composition.composeThisRecord = FieldChanged("DonorID"); Making those two changes should give you the results that you described in your first post. That being said, you can simplify your "ListOfDonations" rule by modifying it to: var returnStr = ''; var ex = new ExternalDataFileEx(PrimaryInputFile(), FusionPro.inputFileDelimiter); // Get an array of record numbers with matching donor IDs. var records = ex.FindRecords('DonorID', Field("DonorID")); // Only loop through the records with matching donor IDs, // rather than looping through every record every time. for (var rec in records) { var ExField = function(field) { return ex.GetFieldValue(records[rec], field); } returnStr += ['Gift Date', 'Gift Applied To', 'Gift Comment', 'Gift Method', 'Gift Amount'].map(ExField).join('<t>') + '<br>'; } return returnStr; Quote
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.