Jump to content

Total Record Count


Recommended Posts

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.

  • Like 1
Link to comment
Share on other sites

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;
Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...