saml Posted January 12, 2012 Share Posted January 12, 2012 I've been working with a client who requires 20 samples of each of the "effort code" field values in my FP template pulling the appropriate page. I've been composing the document and searching in Acrobat for 20 each of the "effort code" values but with 50M to 80M records it gets to be a long process. I have an onRecordstart rule: if (Field("Effort Code") != "ERRXE") { FusionPro.Composition.SetBodyPageUsage("F", false) } if (Field("Effort Code") != "ERRPE") { FusionPro.Composition.SetBodyPageUsage("H", false) } if (Field("Effort Code") != "EIRXE") { FusionPro.Composition.SetBodyPageUsage("J", false) } if (Field("Effort Code") != "EPRXE") { FusionPro.Composition.SetBodyPageUsage("N", false) } if (Field("Effort Code") != "EPRAE") { FusionPro.Composition.SetBodyPageUsage("S", false) } What I'd like to do is limit each value to just 20 records of each just for proofing. Quote Link to comment Share on other sites More sharing options...
rpaterick Posted January 13, 2012 Share Posted January 13, 2012 I would create a "Proof" data file from your list out of excel. Pretty easy to do and saves A LOT of time. Would show all the unique levels and give you the 20 each as well. So you would have your "final" data file and then your "proof" data file. each one you link to for proofing and then running the job. Let me know if you are interested in knowing what the steps are in excel? Quote Link to comment Share on other sites More sharing options...
saml Posted January 16, 2012 Author Share Posted January 16, 2012 They can do it from Mail Manager but the sequence number changes. I'd just like to limit the amount of records from the original file. Quote Link to comment Share on other sites More sharing options...
esmith Posted January 18, 2012 Share Posted January 18, 2012 (edited) I agree with rpaterick. However, if you want to do it your way, perhaps you could give this a shot: Put the following in JavaScript Globals: //counters for each code ERRXE_counter = 0; ERRPE_counter = 0; EIRXE_counter = 0; EPRXE_counter = 0; EPRAE_counter = 0; Then use this in an OnRecordStart rule: var myVersion = Field("Effort Code"); switch (myVersion) { case "ERRXE": ERRXE_counter++; if (ERRXE_counter < 21) FusionPro.Composition.SetBodyPageUsage("F", false); else FusionPro.Composition.composeThisRecord = false; break; case "ERRPE": ERRPE_counter++; if (ERRPE_counter < 21) FusionPro.Composition.SetBodyPageUsage("H", false); else FusionPro.Composition.composeThisRecord = false; break; case "EIRXE": EIRXE_counter++; if (EIRXE_counter < 21) FusionPro.Composition.SetBodyPageUsage("J", false); else FusionPro.Composition.composeThisRecord = false; break; case "EPRXE": EPRXE_counter++; if (EPRXE_counter < 21) FusionPro.Composition.SetBodyPageUsage("N", false); else FusionPro.Composition.composeThisRecord = false; break; case "EPRAE": EPRAE_counter++; if (EPRAE_counter < 21) FusionPro.Composition.SetBodyPageUsage("S", false); else FusionPro.Composition.composeThisRecord = false; break; } The caveat is that I have not tried this code myself so it may not work, but I think the logic is sound. If it fails, there's always the easier method which rpaterick suggests. Edited January 18, 2012 by esmith Quote Link to comment Share on other sites More sharing options...
saml Posted January 19, 2012 Author Share Posted January 19, 2012 Thanks guys I will try and let you know. These proofs are not my request but sales. Quote Link to comment Share on other sites More sharing options...
prescottsnowprint.com Posted January 16, 2013 Share Posted January 16, 2013 I can see that this thread is very old but I thought I would reply anyway. I had a similar situation of needing 5 proof samples for each of several different variable letters. In the past I have always output one at a time and then combined the output pdfs. This was very time consuming especially if there were rounds of corrections. I used a modified version of esmith's code and it worked like a charm. This is going to save me a ton of time. The only thing I wish I could figure out is how I could get the different versions to appear in order one after another instead of mixed up (this is because the data is in presort mailing order). Thanks for the help! Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 16, 2013 Share Posted January 16, 2013 That code can be generalized and reduced quite a bit. First, for the page usage itself, the simplest thing to do is to give the pages in question the same names as the field values, and set them all to Unused initially. Then the OnRecordStart logic to activate the one you want is simply this single line: FusionPro.Composition.SetBodyPageUsage(Field("Effort Code"), true);As for the logic to count the records for each field value, that can be reduced as well. Declare an object in the JavaScript Globals like so: var EffortCodeCount = {};And then you can do this in OnRecordStart: var myVersion = Field("Effort Code"); if (!EffortCodeCount[myVersion]) EffortCodeCount[myVersion] = 0; if (++EffortCodeCount[myVersion] > 20) FusionPro.Composition.composeThisRecord = false; Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 16, 2013 Share Posted January 16, 2013 The only thing I wish I could figure out is how I could get the different versions to appear in order one after another instead of mixed up (this is because the data is in presort mailing order). FusionPro generally outputs records in the same order they're read in from the input data file. However, you could use ExternalDataFileEx to read in the data, then sort it and output it any any order you want. 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.