Jump to content

Turn a Page On or Off based upon Field


traba5058

Recommended Posts

Please Help! I'm creating a new business card template for a new customer that has a different back based upon the title.

 

So, I've setup a 3-page template and named the pages Front, BC and BCBI.

 

If the person's title in the title field is Account Supervisor, Senior Account Supervisor or Field Recruiter, it needs to return page BCBI. Otherwise, it returns page BC.

 

My Rule Validates

[font=Calibri][color=#000000]if (((Field("Title") == "Account Supervisor") || (Field("Title") == "Senior Account Supervisor")) || (Field("Title") == "Field Recruiter"))[/color][/font]
[font=Calibri][color=#000000]{[/color][/font]
[font=Calibri][color=#000000]FusionPro.Composition.SetBodyPageUsage("BCBI", true);[/color][/font]
[font=Calibri][color=#000000]FusionPro.Composition.SetBodyPageUsage("BC", false);[/color][/font]
[font=Calibri][color=#000000]}[/color][/font]

[font=Calibri][color=#000000]else[/color][/font]
[font=Calibri][color=#000000]{[/color][/font]
[font=Calibri][color=#000000]FusionPro.Composition.SetBodyPageUsage("BCBI", false);[/color][/font]
[font=Calibri][color=#000000]FusionPro.Composition.SetBodyPageUsage("BC", true);[/color][/font]
[font=Calibri][color=#000000]}[/color][/font]

But, I get the following error when I compose:

Compose Error:

OnJobStart, line 1: Error: In Field(), no data source defined or data could not be loaded

Job started 18:27:44 - 1352330864.

Creator: FusionPro Desktop 7.2P1k

Computer Name: STPRESSTRABA

Current working folder: D:\Customers\Hospitality Staffing Services\Products\Templates\BC\BCBI Composed

Template File: D:\Customers\Hospitality Staffing Services\Products\Templates\BC\BC_BCBI_BusinessCard_Template.pdf

Input File: D:\Customers\Hospitality Staffing Services\Products\Templates\BC\bc_bi.txt

Composing record #1, input record 1

Composing record #2, input record 2

Composing record #3, input record 3

Composing record #4, input record 4

Composing record #5, input record 5

Composing record #6, input record 6

Composing record #7, input record 7

Composing record #8, input record 8

Job ended 18:27:50 - 1352330870.

Don't know if it's related:

I also have a graphic rule setup to place the correct background image on the page based upon the Title field. This rule is assigned to the background graphic on pages 2 & 3, which are the two backs of the card.

 

My Rule:

switch (Field("Title").toLowerCase())
{
case "Account Supervisor".toLowerCase():
 return Resource("BCBI_BusinessCard_Back.pdf");
case "Administrative Assistant".toLowerCase():
 return Resource("BC_BusinessCard_Back.pdf");
case "Area Manager".toLowerCase():
 return Resource("BC_BusinessCard_Back.pdf");
case "Business Development Coordinator".toLowerCase():
 return Resource("BC_BusinessCard_Back.pdf");
case "Director of Operations".toLowerCase():
 return Resource("BC_BusinessCard_Back.pdf");
case "Field Recruiter".toLowerCase():
 return Resource("BCBI_BusinessCard_Back.pdf");
case "President/CEO".toLowerCase():
 return Resource("BC_BusinessCard_Back.pdf");
case "Senior Account Executive".toLowerCase():
 return Resource("BC_BusinessCard_Back.pdf");
case "Senior Account Supervisor".toLowerCase():
 return Resource("BCBI_BusinessCard_Back.pdf");
case "Vice President".toLowerCase():
 return Resource("BC_BusinessCard_Back.pdf");
case "Vice President of Operations".toLowerCase():
 return Resource("BC_BusinessCard_Back.pdf");
case "eCommerce Systems Manager".toLowerCase():
 return Resource("BC_BusinessCard_Back.pdf");
default:
 return "";
}

 

The composed file is creating 2 outputs for every record: one for each background image & back page (2 or 3).

 

This is the first time I am selecting pages in a template, so I pulled up my post card template that I created during PTI training to see how we did it there and tried to replicate it. I do not understand what I have done wrong.

 

Please help.

Link to comment
Share on other sites

On first glance, it looks like the two rules are solving the same problem. You are returning either back BC or back BCBI to a graphic frame on both page BC and page BCBI (via the graphic rule), but then (possibly) activating only the necessary back page based on the same data (via the callback rule).

 

Also, based on the error you posted, I'm guessing your "SetBodyPageUsage" rule is in an OnJobStart rule rather than the OnRecordStart rule.

Link to comment
Share on other sites

I think your best bet would be to delete page 3 (BCBI) and leave both pages (front/BC) "Used" in page management. Then delete your callback rule (or at least the code entered above) regardless of whether it was in an OnJobStart rule or an OnRecordStart rule. Finally, pull in the correct back page graphic to page BC using the rule you created, but simplifying it to read:

switch (Field("Title").toLowerCase()) {
  case "account supervisor":
  case "field recruiter":
  case "senior account supervisor":
  return Resource("BCBI_BusinessCard_Back.pdf");

  case "administrative assistant":
  case "area manager":
  case "business development coordinator":
  case "director of operations":
  case "president/ceo":
  case "senior account executive":
  case "vice president":
  case "vice president of operations":
  case "ecommerce systems manager":
  default:
  return Resource("BC_BusinessCard_Back.pdf");
}

If I understand what you are trying to do, these changes should get you back on track. Good luck!

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