Jump to content

Repeating Records Based on Quantity in Data File


ChuckBrodeur

Recommended Posts

I have an imposition definition template set up in FusionPro Producer (API) 9.2.31 working on a mac using Adobe XI and CS6 that is set up with a 3.5 inch x 1.5 inch document imposed 3 wide by 11 high on a 12.5 inch x 17.5 inch sheet. What I am trying to do is output my data so that a field named "PrintQTY" informs FusionPro as to how many of each record to print across the template before switching to the next record. For example; if record "A" indicates a print quantity of "3", it will put three record "A"s across the top row; if record "B" has a print quantity of "7", it will then drop down a row, print 3 Record "B"s across, drop another row and print another 3 Record "B"s, drop another row and print the last record "B"; then move on the record "C" in the next field to the right of the last Record "B" and continue from there. I do now know how to write this rule.

 

Any help?

Link to comment
Share on other sites

That's not really how Imposition works. It wants to completely fill as many imposed sheets as possible, and emit a single partially-filled sheet only at the end of an output file or stack, if necessary.

 

However, assuming you have a one-page template, I think you can get the output you want by adding a blank page to the template, and repeating it as many times as necessary to fill up the extra space on the last row, something like this in OnRecordStart:

var repeatCount = Int(Field("PrintQTY"));
FusionPro.Composition.repeatRecordCount = Math.ceil(repeatCount / 3) * 3; // next multiple of 3, to fill a row on the imposed output sheet
FusionPro.Composition.SetBodyPageUsage(1, FusionPro.Composition.repeatRecordNumber <= repeatCount);
FusionPro.Composition.SetBodyPageUsage(2, FusionPro.Composition.repeatRecordNumber > repeatCount);

Link to comment
Share on other sites

maybe I am not describing what I want to do correctly. Let me try a different way. I have a single document that is 3.5x1.5 inches. I have text fields set up to show the data. In my data there is also a field for PrintQTY. My data falls into 4 categories and I have set my text fields to reflect that. PO, Job, SKU, and main body copy. Each type has a related print quantity designated. What I want to do is set up a rule so that the PO data prints a document the number of times indicated in the printqty field, then the Job data does the same thing, followed by SKU, then all of the first item however many times needed, and this keeps repeating until all the rows in my data have been printed. I can get them all to print in the order I want, but they only print one of each, not the quantity indicated in the printqty field.
Link to comment
Share on other sites

maybe I am not describing what I want to do correctly. Let me try a different way. I have a single document that is 3.5x1.5 inches. I have text fields set up to show the data. In my data there is also a field for PrintQTY. My data falls into 4 categories and I have set my text fields to reflect that. PO, Job, SKU, and main body copy. Each type has a related print quantity designated. What I want to do is set up a rule so that the PO data prints a document the number of times indicated in the printqty field, then the Job data does the same thing, followed by SKU, then all of the first item however many times needed, and this keeps repeating until all the rows in my data have been printed. I can get them all to print in the order I want, but they only print one of each, not the quantity indicated in the printqty field.

Did you try what I suggested? Did it not work? If not, how was the output different than what you were expecting?

 

A picture or two, or at least a mockup of the output, might be worth a thousand words here. Collecting up the job and posting it may be even more illuminating.

Link to comment
Share on other sites

What I really want to do in your suggestion is replace the hard coded 3 and replace it with the corresponding number in the data field for that record. I have attached my file that I am working with and the data and fpi files. I have also attached a pdf of what I am trying to achieve (although I could not get the page size exactly correct with my driver you can get the idea).

 

Thanks.

22418.pdf

ColdWaterCreek.fpi

243218030_1716133_OP-zBR23Rm.txt

243218030_Bag Label[1].pdf

Link to comment
Share on other sites

Got it to work! I change the repeatCount to "* 1" and everything fell into place! Thanks!

 

var repeatCount = Int(Field("PrintQty"));

FusionPro.Composition.repeatRecordCount = Math.ceil(repeatCount * 1);

FusionPro.Composition.SetBodyPageUsage(1, FusionPro.Composition.repeatRecordNumber <= repeatCount);

FusionPro.Composition.SetBodyPageUsage(2, FusionPro.Composition.repeatRecordNumber > repeatCount);

Link to comment
Share on other sites

By the way, the code you supplied worked pretty well except for the SKU row left two blanks and I wanted the blanks eliminated. Can I throw in an if clause that would not repeat three times of the PrintQty is less than three?

I thought that leaving the rest of the row blank was what you wanted, from this description in your original post:

if record "B" has a print quantity of "7", it will then drop down a row, print 3 Record "B"s across, drop another row and print another 3 Record "B"s, drop another row and print the last record "B"

What else did you mean by "drop down a row" other than that the rest of the row should be blank?

Got it to work! I change the repeatCount to "* 1" and everything fell into place! Thanks!

...

FusionPro.Composition.repeatRecordCount = Math.ceil(repeatCount * 1);

...

I don't see how multiplying a number by 1 could possibly make a difference, but if it's working the way you want and you're happy, then I'm happy. :)

Link to comment
Share on other sites

It is hard to describe print output in words sometimes. I meant that i wanted to "drop down a row" when the row was complete but if there was not enough quantity left for a record to fill the row to start the next record leaving no blank spaces. I don't know if that even explains it(!)...

 

As for the javascript, I don't know enough about it to even begin explaining how or why multiplying by 1 works, but I was tweaking the code while I was waiting for a response and this combination worked. If there is a better way to write it then I don't know enough yet to do it myself.

Link to comment
Share on other sites

It is hard to describe print output in words sometimes. I meant that i wanted to "drop down a row" when the row was complete but if there was not enough quantity left for a record to fill the row to start the next record leaving no blank spaces. I don't know if that even explains it(!)...

 

As for the javascript, I don't know enough about it to even begin explaining how or why multiplying by 1 works, but I was tweaking the code while I was waiting for a response and this combination worked. If there is a better way to write it then I don't know enough yet to do it myself.

I see. If that's the case, then you don't need that second blank page in the template at all, and all the rule needs to have is simply this single line of code:

FusionPro.Composition.repeatRecordCount = Int(Field("PrintQTY"));

This works the same way whether you're using imposition or not. All you really want to do is repeat the record. You just happen to be using imposition which has a horizontal repeat first, so the records just fill "rows" as they're output, with or without repeats. It was just that your initial description with all the stuff about "drop down a row" made what you wanted seem a lot more complicated than it really was (at least to me).

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...