Jump to content

Inline repeat composition


Recommended Posts

I am trying to figure out which FP component will work to repeat the current record amounts. The scenario goes like this:

 

Have a tagged markup file that reads like so:

<record>

<story copyhole="TCSFileNumber1">001-NS-010</story>

<story copyhole="Amount1">10</story>

<story copyhole="TCSFileNumber2">001-NS-005</story>

<story copyhole="Amount2">3</story>

<story copyhole="TCSFileNumber3">001-NS-008</story>

<story copyhole="Amount3">5</story>

<story copyhole="TCSFileNumber4"></story>

<story copyhole="Amount4"></story>

<story copyhole="TCSFileNumber5"></story>

<story copyhole="Amount5"></story>

<story copyhole="TCSFileNumber6"></story>

<story copyhole="Amount6"></story>

<story copyhole="TCSFileNumber7"></story>

<story copyhole="Amount7"></story>

<story copyhole="TCSFileNumber8"></story>

<story copyhole="Amount8"></story>

<story copyhole="TCSFileNumber9"></story>

<story copyhole="Amount9"></story>

<story copyhole="TCSFileNumber10"></story>

<story copyhole="Amount10"></story>

<story copyhole="TCSFileNumber11"></story>

<story copyhole="Amount11"></story>

<story copyhole="TCSFileNumber12"></story>

<story copyhole="Amount12"></story>

</record>

 

 

OnRecordStart is as follows:

for (var i = 1; i <= 12; i++)

{

datafield = Field('TCSFileNumber' + i);

if(datafield != "" )

{

FusionPro.Composition.SetBodyPageUsage(i,true);

}

 

qtyfield = Field('Amount' + i);

 

if(qtyfield != "" )

{

FusionPro.Composition.repeatRecordCount = qtyfield;

}

}

 

I got the SetBodyPaegUsage down with a loop that displays the right pages if the "TCSFileNumber" is not empty but when i compose, the loop i have for the "Amount" does not repeat the current record amounts for Amount1 to Amount 2 etc. It is going with the last "Amount" value and not placing them inline. What should i be using to capture the current record amounts and compose them inline correctly?

Link to comment
Share on other sites

The problem is that the repeatRecordCount object can only accept one value per record so it pulls the last valid number from your FOR loop in the OnRecordStart callback rule. I'm thinking that instead of setting this up with template pages that are used or unused, you should instead consider using overflow pages and importing your "TCSFileNumbers" multiple times per your record data, flowing each into an overflow page as necessary for the correct quantity.
Link to comment
Share on other sites

I'm thinking that instead of setting this up with template pages that are used or unused, you should instead consider using overflow pages and importing your "TCSFileNumbers" multiple times per your record data, flowing each into an overflow page as necessary for the correct quantity.

 

Eric, do you have a sample you could point me towards? I seem to have run into a wall on this one.

Link to comment
Share on other sites

I don't know that I can provide an example that matches the EXACT scenario you are dealing with. You can review the files I uploaded in this thread that discuss an answer to my problem of using overflow to pages to add all pages from a resource PDF, although that probably isn't what you are trying to accomplish above.

 

I'm thinking that you would do something similar, but create a rule that includes nested FOR loops -- the main one to run 1-12 possible FileNumbers and the embedded one running 1 through N where N equals the number of copies you want to generate of each FileNumber.

 

These kind of scenarios are really hard to help with on a forum due to the complexity and the lack of time to devote to them. Hopefully the poor example thread above is enough to get you started. :)

Link to comment
Share on other sites

Eric, did you ever get the error "The specified Keep conditions could not be honored in the flow <>. Text is truncated."? The validation in the rule eidot shows the pdfs are going to be inserted in line but the composition is blank.
Link to comment
Share on other sites

Eric, did you ever get the error "The specified Keep conditions could not be honored in the flow <>. Text is truncated."?

That is not a familiar error to me. Not sure what "Keep conditions" would be?

 

The validation in the rule eidot shows the pdfs are going to be inserted in line but the composition is blank.

Not sure what word "eidot" was supposed to be. This sounds like the same problem I was having in my original post of the linked thread above, but figured out in a later solution. Did you incorporate the code posted at the end of the other thread?

Link to comment
Share on other sites

i meant editor but i got it working without the first loop, which i need to see where the nesting is falling off. Turns out the size of the overflow page needs to be bigger in size (don't know why) than the actual master page. The only thing i did notice is that i get a blank sheet as the first sheet then the actual pages. Here is what i got so far:

 

if(FusionPro.isMac)

{

ImagePath = ":Images:";

}

 

if(FusionPro.isWindows)

{

ImagePath = "";

}

 

 

for (var i = 1; i <= 12; i++){

var datafield = Field('TCSFileNumber' + i);

var filenumber = ReplaceSubstring(datafield, "-", "_");

var pdfname = filenumber;

var resource = CreateResource(ImagePath + pdfname + ".pdf" ,'graphic' ,'no');

var markup = "";

 

 

 

for (var i = 1; i <= 12; i++) {

var qty = Field('Amount' + i);

if (qty > 1)

{

markup += '<graphic file="' +resource.name + '" position="afterline"/>\n';

markup += '<P>';

}

if (qty = "")

{

markup += '';

}

}

}

 

markup = Left(markup, markup.length - 3);

 

 

return markup;

Link to comment
Share on other sites

Got this figured out. The only issue is getting that blank page in the beginning from the master page to not show up as a blank.

 

if(FusionPro.isMac)

{

ImagePath = ":Images:";

}

if(FusionPro.isWindows)

{

ImagePath = "";

}

 

var markup = "";

for (i = 1; i <= 12; i++){

var datafield = Field('TCSFileNumber' + i);

var filenumber = ReplaceSubstring(datafield, "-", "_");

var pdfname = filenumber;

var resource = CreateResource(ImagePath + pdfname + ".pdf" ,'graphic' ,'no');

var qty = Field('Amount' + i);

 

for (j = 1; j <= qty; j++){

if (qty != "" && datafield != "")

{

markup += '<graphic file="' + resource.name + '" position="afterline"/>\n';

markup += '<P>';

}

else

markup += '';

}

}

 

markup = Left(markup, markup.length - 3);

 

return markup;

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...