aparkssiskfs.com Posted January 8 Share Posted January 8 Hi, I'm just trying to get the total record count to print on my letter. Say I have 10 records in my file. I want each page to print as: 1 of 10, 2 of 10, 3 of 10...etc. This seems so simple but I'm having a hard time just figuring out the total count number. Thanks for any help. 1 Quote Link to comment Share on other sites More sharing options...
NoahScheitler Posted January 8 Share Posted January 8 For this all you need to do is create a new blank javascript rule. For the programming of the rule enter: return CurrentRecordNumber() + " of 10" Then insert that rule in your text box and you should be good to go. 1 Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 8 Share Posted January 8 If you want the true number of total records, you can either use the $outputrecordnumber and $totalrecordcount variables in the Text Editor, or create a rule like so: return FusionPro.Composition.outputRecordNumber + " of " + FusionPro.Composition.totalRecordCount; But either way, you need to set the job to do preprocessing to determine the total number of record, in OnJobStart, like so: FusionPro.Composition.forcePreprocessing = true; Quote Link to comment Share on other sites More sharing options...
aparkssiskfs.com Posted January 8 Author Share Posted January 8 Hi Dan, I did what you said but it gives me 1 of 0. Not the quantity of the file? I will try again in the morning when I get back into the office but do you have any suggestions on what im missing? When I validate the expression, it says, 1 of undefined Thanks for the response. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 8 Share Posted January 8 6 minutes ago, aparkssiskfs.com said: I did what you said but it gives me 1 of 0. Not the quantity of the file? I will try again in the morning when I get back into the office but do you have any suggestions on what im missing? When I validate the expression, it says, 1 of undefined Any property of FusionPro.Composition is going to be valid at composition time, but not at rule validation time. Compose the job and the output should be correct. 1 Quote Link to comment Share on other sites More sharing options...
aparkssiskfs.com Posted January 9 Author Share Posted January 9 21 hours ago, Dan Korn said: If you want the true number of total records, you can either use the $outputrecordnumber and $totalrecordcount variables in the Text Editor, or create a rule like so: return FusionPro.Composition.outputRecordNumber + " of " + FusionPro.Composition.totalRecordCount; But either way, you need to set the job to do preprocessing to determine the total number of record, in OnJobStart, like so: FusionPro.Composition.forcePreprocessing = true; 20 hours ago, Dan Korn said: Any property of FusionPro.Composition is going to be valid at composition time, but not at rule validation time. Compose the job and the output should be correct. Thank you Dan, that worked just how I needed it to. One thing I did wrong, I was using OnRecordStart not OnJobStart - that makes a difference apparently (not sure why). I somewhat knew that some things validate during the composition but I didn't know that any property containing FusionPro.Composition happens during composing only. I'm slowly learning FP, I have been teaching myself. Thanks for the help, I appreciate it. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 9 Share Posted January 9 52 minutes ago, aparkssiskfs.com said: Thank you Dan, that worked just how I needed it to. One thing I did wrong, I was using OnRecordStart not OnJobStart - that makes a difference apparently (not sure why). If you think about it, the total number of records doesn't change per-record, it's a job-level thing. And it has to be calculated ahead of time, in a preprocessing step, and you obviously have to tell FusionPro to do that preprocessing at the start of the whole job. FusionPro doesn't do preprocessing by default, as there is a bit of a time cost to it, but in cases like this, there's no other way to know for sure how many records will be composed. 1 hour ago, aparkssiskfs.com said: I somewhat knew that some things validate during the composition but I didn't know that any property containing FusionPro.Composition happens during composing only. Some things can be examined and calculated at rule validation time, in the Rule Editor, like the values of fields, but other things have no context outside of a composition, like activating pages. The Validate button in the editor is for convenience, to help in the development and debugging of rules, but ultimately, the composed output is what matters. 1 hour ago, aparkssiskfs.com said: I'm slowly learning FP, I have been teaching myself. Thanks for the help, I appreciate it. Sure, glad to help. You're part of a great community here. 1 Quote Link to comment Share on other sites More sharing options...
aparkssiskfs.com Posted January 9 Author Share Posted January 9 38 minutes ago, Dan Korn said: If you think about it, the total number of records doesn't change per-record, it's a job-level thing. And it has to be calculated ahead of time, in a preprocessing step, and you obviously have to tell FusionPro to do that preprocessing at the start of the whole job. FusionPro doesn't do preprocessing by default, as there is a bit of a time cost to it, but in cases like this, there's no other way to know for sure how many records will be composed. Some things can be examined and calculated at rule validation time, in the Rule Editor, like the values of fields, but other things have no context outside of a composition, like activating pages. The Validate button in the editor is for convenience, to help in the development and debugging of rules, but ultimately, the composed output is what matters. Sure, glad to help. You're part of a great community here. Thanks for for taking the time to explain all that! I agree, this is a great place. 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.