Jump to content

Print Page(s) based on data


Recommended Posts

Hello - I created a 3 Page (two sheet duplex) FP Creator Template. The first page (sheet) is Letter size paper (single-sided) and the second page (sheet) is Statement size paper (duplex). Based on data in a field name (Frontgraphic - example below), I want to print a different image file. I am using a switch rule to call the image file based on the data. My issue is that I print too many pages. Because I have a three page Template...for every row of data, the output is three pages. I am looking for it to print one page, based on data. If the data is "auton" I want to print the Letter size page. If the data is "091404-1", I want to print the Statement size page.

 

Can anyone tell me what I might be doing wrong? Or, what I might need to do to provide the output I am looking for? Should I not have three pages in my template?

 

Thanks in advance for your help.

 

Kevin Klansky

FP Novice

 

 

Frontgraphicauton091404-1091405-1091406-1auton091403-1091401-1091402-1091400-1auton100426-1100425-1100429-1

Link to comment
Share on other sites

You'll want to name your pages in the Page Usage dialog, then add some logic to the OnRecordStart callback rule to enable the pages you want to output for each record. Something like this:

FusionPro.Composition.SetBodyPageUsage("Letter", Field("Frontgraphic") == "auton");
FusionPro.Composition.SetBodyPageUsage("Statement", Field("Frontgraphic") == "091404-1");

For more information, refer to the section "How to switch body pages during composition" in the FusionPro Rules System Guide.

Link to comment
Share on other sites

Hi Dan - thank you for your reply. I did what you suggested and am still a little stumped. I created an OnRecordStart callback rule - see below

 

FusionPro.Composition.SetBodyPageUsage("CoverPage", Field("Frontgraphic") == "auton");

FusionPro.Composition.SetBodyPageUsage("GCFront", Field("Frontgraphic") == "091404-1");

FusionPro.Composition.SetBodyPageUsage("GCFront", Field("Frontgraphic") == "091405-1");

 

I skinnied down my db file to only include three records. When I compose this...the middle one "091404-1 does not print. If I increase the amount of records...the first one "auton" prints, and the last one...call it "091410-1" prints...but the 2-9 (the middle records) do not print.

 

I read the manual you suggested and tried to create the rule they have as an example...but get the following error:

 

" OnRecordStart, line 1: SyntaxError: missing ( before condition "

 

Any chance I can collect this template and send it to you so you can have a look? Thanks in advance for your time.

Link to comment
Share on other sites

You can feel free to post the collected job here on the forum, and someone might take a look at it. I probably won't have time to look at it myself. You can always send it to Support as well.

 

If you could simply post the entirety of the rule which generates the syntax error, it will probably be easy to figure out what's wrong there.

Link to comment
Share on other sites

This code is conflicting with itself:

FusionPro.Composition.SetBodyPageUsage("GCFront", Field("Frontgraphic") == "091404-1");
FusionPro.Composition.SetBodyPageUsage("GCFront", Field("Frontgraphic") == "091405-1");

 

If the field "Frontgraphic" is "091404-1" "GCFront" page is turned on, but since it can't also be "091405-1" at the same time, "GCFront" is turned off.

Link to comment
Share on other sites

This code is conflicting with itself:

FusionPro.Composition.SetBodyPageUsage("GCFront", Field("Frontgraphic") == "091404-1");
FusionPro.Composition.SetBodyPageUsage("GCFront", Field("Frontgraphic") == "091405-1");

If the field "Frontgraphic" is "091404-1" "GCFront" page is turned on, but since it can't also be "091405-1" at the same time, "GCFront" is turned off.

Right. You might need to do this:

FusionPro.Composition.SetBodyPageUsage("GCFront", Field("Frontgraphic") == "091405-1" || Field("Frontgraphic") == "091404-1");

How many different values of that field are there that can enable the front page? You might want to use a switch statement or something else instead.

Link to comment
Share on other sites

Thank you Step and Dan - I think I have this figured out. I am using the following for OnRecordStart:

 

if ( (Field("Frontgraphic").toLowerCase()) == "auton" )

{

FusionPro.Composition.SetBodyPageUsage("Front Page",true);

FusionPro.Composition.SetBodyPageUsage("Back Page",true);

FusionPro.Composition.SetBodyPageUsage("GC Front",false);

FusionPro.Composition.SetBodyPageUsage("GC Back",false);

} [/color]

else

{

FusionPro.Composition.SetBodyPageUsage("Front Page",false);

FusionPro.Composition.SetBodyPageUsage("Back Page",false);

FusionPro.Composition.SetBodyPageUsage("GC Front",true);

FusionPro.Composition.SetBodyPageUsage("GC Back",true);

}

return ""

 

 

 

Then for the Letter page I am using this:

 

if ( (Field("Frontgraphic").toLowerCase()) == "auton" )

return Resource("AutoN.pdf");

else

return NullResource();

 

 

 

Then for the Statement Page I am using this:

 

if ( (Field("Frontgraphic").toLowerCase()) == "auton" )

return NullResource();

else

return Resource((Field("Frontgraphic").toLowerCase()) + ".pdf");

 

 

I have similar javascripts for the back page of the Statement and Letter pages. Thank you for your guidance and help with this! Much appreciated!

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