Jump to content

Repeat Record


mclisa81

Recommended Posts

I'm using a repeatRecordCount in my OnRecordStart rule. Our Igen operator would like this broken up into output files of 2 records per file. So I have output to multiple files, records 2 in my composition settings. It works fine until it tries to compose 2 records that have a value of "0" in the same output file. I get this error in the log----

 

Begun composing record #1

No page is emitted, please check page usage in your input file.

Begun composing record #2

No page is emitted, please check page usage in your input file.

A body page does not have master page assigned.

A blank page is emitted since no record is composed properly.

PDF Library Document Write Error: Bad parameter.

Job aborted with error.

 

Acrobat then gives me a fatal FusionPro error and aborts.

 

Here is my OnRecordStart rule

 

if (Field("QtyNPL")=="0")
{
FusionPro.Composition.SetBodyPageUsage("A1", false)
   FusionPro.Composition.SetBodyPageUsage("A2", false)
FusionPro.Composition.SetBodyPageUsage("A3", false)
   FusionPro.Composition.SetBodyPageUsage("A4", false)
FusionPro.Composition.SetBodyPageUsage("A5", false)
   FusionPro.Composition.SetBodyPageUsage("A6", false)
FusionPro.Composition.SetBodyPageUsage("A7", false)
   FusionPro.Composition.SetBodyPageUsage("A8", false)
FusionPro.Composition.SetBodyPageUsage("A9", false)
   FusionPro.Composition.SetBodyPageUsage("A10", false)
FusionPro.Composition.SetBodyPageUsage("A11", false)
   FusionPro.Composition.SetBodyPageUsage("A12", false)
FusionPro.Composition.SetBodyPageUsage("A13", false)
   FusionPro.Composition.SetBodyPageUsage("A14", false)
FusionPro.Composition.SetBodyPageUsage("A15", false)
   FusionPro.Composition.SetBodyPageUsage("A16", false)
FusionPro.Composition.SetBodyPageUsage("A17", false)
   FusionPro.Composition.SetBodyPageUsage("A18", false)
FusionPro.Composition.SetBodyPageUsage("A19", false)
   FusionPro.Composition.SetBodyPageUsage("A20", false)
FusionPro.Composition.SetBodyPageUsage("A21", false)
   FusionPro.Composition.SetBodyPageUsage("A22", false)
FusionPro.Composition.SetBodyPageUsage("A23", false)
   FusionPro.Composition.SetBodyPageUsage("A24", false)
FusionPro.Composition.SetBodyPageUsage("A25", false)
   FusionPro.Composition.SetBodyPageUsage("A26", false)
FusionPro.Composition.SetBodyPageUsage("A27", false)
   FusionPro.Composition.SetBodyPageUsage("A28", false)
FusionPro.Composition.SetBodyPageUsage("A29", false)
   FusionPro.Composition.SetBodyPageUsage("A30", false)
FusionPro.Composition.SetBodyPageUsage("A31", false)
   FusionPro.Composition.SetBodyPageUsage("A32", false)
FusionPro.Composition.SetBodyPageUsage("A33", false)
   FusionPro.Composition.SetBodyPageUsage("A34", false)
FusionPro.Composition.SetBodyPageUsage("A35", false)
   FusionPro.Composition.SetBodyPageUsage("A36", false)
FusionPro.Composition.SetBodyPageUsage("A37", false)
   FusionPro.Composition.SetBodyPageUsage("A38", false)
FusionPro.Composition.SetBodyPageUsage("A39", false)
   FusionPro.Composition.SetBodyPageUsage("A40", false)
FusionPro.Composition.SetBodyPageUsage("A41", false)
   FusionPro.Composition.SetBodyPageUsage("A42", false)
FusionPro.Composition.SetBodyPageUsage("A43", false)
   FusionPro.Composition.SetBodyPageUsage("A44", false)
FusionPro.Composition.SetBodyPageUsage("A45", false)
   FusionPro.Composition.SetBodyPageUsage("A46", false)
FusionPro.Composition.SetBodyPageUsage("A47", false)
   FusionPro.Composition.SetBodyPageUsage("A48", false)
FusionPro.Composition.SetBodyPageUsage("A49", false)
   FusionPro.Composition.SetBodyPageUsage("A50", false)
FusionPro.Composition.SetBodyPageUsage("A51", false)
   FusionPro.Composition.SetBodyPageUsage("A52", false)
}
else
FusionPro.Composition.repeatRecordCount=Field("QtyNPL");

 

Any help would be appreciated. Thanks.

Link to comment
Share on other sites

Wow, that's a lot of code to do something simple. At the very least, I would replace those 52 lines of code with a loop, like so:

if (Field("QtyNPL")=="0")
{
 for (var i = 1; i <= 52; i++)
   FusionPro.Composition.SetBodyPageUsage("A" + i, false);
}
else
 FusionPro.Composition.repeatRecordCount = Field("QtyNPL");

But, I think what you want to do, rather than turning off all of the pages in the job, is even simpler:

if (Field("QtyNPL")=="0")
 FusionPro.Composition.composeThisRecord = false;
else
 FusionPro.Composition.repeatRecordCount = Field("QtyNPL");

Link to comment
Share on other sites

Thanks for the shortcut Dan. I'm a novice at coding and I usually pick up bits and pieces from the forums that help me accomplish what I need to, even though I usually go about it the LONG way.

 

So, I have a tidy rule now, but I still have the same error. If I set my composition settings to multiple files of 2 records, and I have 2 records that are "0", it throws the original error above.

Link to comment
Share on other sites

I have a tidy rule now, but I still have the same error. If I set my composition settings to multiple files of 2 records, and I have 2 records that are "0", it throws the original error above.

I'm not able to reproduce this. I can take an example job (like the Frodo Travel tutorial) and do this in OnRecordStart:

if (FusionPro.Composition.inputRecordNumber != 3)
 FusionPro.Composition.composeThisRecord = false;

And it correctly outputs only record three, regardless of the "Output to multiple files" settings on the Output tab of the Composition Settings dialog.

 

There must be something else you're doing that I don't know about. Could you collect up a minimal example that demonstrates the problem and attach it to this thread?

Link to comment
Share on other sites

So, I have a tidy rule now, but I still have the same error. If I set my composition settings to multiple files of 2 records, and I have 2 records that are "0", it throws the original error above.

To be clear, if you were to replace your LONG code (your words) with Dan's condensed version doing the same thing, you would likely get the same result, but if you use his second suggestion, FP should skip over records where Field("QtyNPL")=="0". In this scenario, FP should never compose records with 0 pages returned and thus never get an error forcing an abort. :)

Link to comment
Share on other sites

  • 2 weeks later...

OK, finally. #2 of Dans is what I used and it worked perfectly. I have 1 more question on this template. I need to add a flag on each page for kitting. So, I need a rule that will count incrementally from 1 up to the # in the QtyNCL field.

 

for example, if there is a 5 in the QtyNCL field, I need a rule to start with 1 and return counts up to 5.

 

for the 1st repeat it will return the following on each page

1 of 5

 

2nd repeat

2 of 5

 

3rd repeat

3 of 5

 

4th repeat

4 of 5

 

5th repeat

5 of 5

 

I hope this makes sense. I tried a loop but it didn't seem to be working with the repeat record, although it could have been an error on my part. Thanks in advance

Link to comment
Share on other sites

So, I need a rule that will count incrementally from 1 up to the # in the QtyNCL field.

 

for example, if there is a 5 in the QtyNCL field, I need a rule to start with 1 and return counts up to 5.

 

for the 1st repeat it will return the following on each page

1 of 5

 

2nd repeat

2 of 5

<snip>

This is easy to do; you don't even need a rule. In the Variable Text Editor, in the Variable drop-down, just insert the $repeatrecordnumber and $repeatrecordcount variables (with the word "of" in between). You could also use the FusionPro.Composition.repeatRecordNumber and FusionPro.Composition.repeatRecordCount properties in a rule.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...