Jump to content

Suppressing Text Frames Under Multiple Circumstances


StacyZ

Recommended Posts

Hi,

 

I'm wondering if somebody can help with an issue we've encountered suppressing text frames.

 

Recently, we had a job using 4 different postcards (all 2-sided) using the same data file. We did this for the presorted postal rates. We needed to keep all of the records in sequential order despite the fact that they use different artwork backgrounds.

 

I saved PDFs of the art and pulled them in using a field in the data to get the proper background per record, no problem there. The problem I had was suppressing text frames that needed to suppress when they weren't needed per the art.

 

For example, Background A has 4 text frames at 345º, Background B has 3 text frames at 0º, Background C has 3 text frames at 0º(different locations than BG B), and Background D has 6 text frames at 90º. All of the text frames are in different locations from postcard to postcard.

 

Each text frame has a unique name. I tried to apply a Callback Rule but that didn’t work with more than 2 backgrounds.

 

Is there a way to suppress multiple text frames under three or more circumstances?

 

This is a big issue at my company because we are trying to convert from an old PReS system to 100% FusionPro. Given the amount of direct mail we produce, we need to solve this issue in order to move forward in that conversion.

 

Any help is appreciated.

 

Thank you.

Link to comment
Share on other sites

You could build it two different ways that I know of. The way I normally do this is to create text resources for the information needed in the text boxes and build switches on the same field you use for the backgrounds. This works well if your text is the same but in different locations on the different backgrounds.

 

Otherwise you could use an 8 page template and set-up each page as it was its own template and name the pages to correspond with a field in the data. Then have an OnRecord start rule that calls out that field to trigger which pages to use. This method makes the composition run much slower since it runs through all 8 pages for each record.

Link to comment
Share on other sites

For example, Background A has 4 text frames at 345º, Background B has 3 text frames at 0º, Background C has 3 text frames at 0º(different locations than BG B), and Background D has 6 text frames at 90º. All of the text frames are in different locations from postcard to postcard.

 

Each text frame has a unique name. I tried to apply a Callback Rule but that didn’t work with more than 2 backgrounds.

 

Is there a way to suppress multiple text frames under three or more circumstances?

Can you elaborate on what you mean by "I tried to apply a Callback Rule but that didn't work?" Which Callback rule did you write code for? And what was the result that you got from the code you wrote that didn't work?

 

I think dreimer's suggestion is probably the easiest to maintain. You can duplicate the body pages for each version, go to FusionPro > Manage Pages > Page Usage, and edit each page to have a unique name and set it to unused. For example:

  1. "Background A"
  2. "Background A-back"
  3. "Background B"
  4. "Background B-back"
  5. "Background C"
  6. "Background C-back"
  7. "Background D"
  8. "Background D-back"

 

Then, you can delete the B, C, and D frames from the A postcard and so forth. That way, you don't have to both with toggling individual text frames for every record, instead you just turn "on" the appropriate body page for that record (and all of its text frames). You'd put this in an OnRecordStart callback:

var trigger = Field("Postcard"); // Field used to determine which postcard to use
FusionPro.Composition.SetBodyPageUsage(trigger, true);
FusionPro.Composition.SetBodyPageUsage(trigger + '-back', true);

 

If all four versions have a common back, you could set up your pages as:

  1. "Background A" Unused
  2. "Background B" Unused
  3. "Background C" Unused
  4. "Background D" Unused
  5. "back" Used

 

And then you'd only have to determine which front to use from your OnRecordStart rule:

FusionPro.Composition.SetBodyPageUsage(Field("postcard"), true);

 

And while I feel like that may be the easier way to handle this scenario, I realize it doesn't exactly answer your question. So, if you still want to have the text frames of all four versions on one page, here's how you'd do that: In an OnRecordStart callback rule, you can define the frames associated with each postcard and then suppress the ones that don't match the current version:

var trigger = Field("Postcard"); // Field used to determine which postcard to use
var frames = [];

// Frame names when 'Background A' is used
frames['Background A'] = [
 'Frame 1',
 'Frame 2',
 'Frame 3',
 'Frame 4'
];

// Frame names when 'Background B' is used
frames['Background B'] = [
 'Frame 5',
 'Frame 6',
 'Frame 7'
];

// etc

for (var i in frames)
   frames[i].forEach(function(s){FindTextFrame(s).suppress = i != trigger });

 

Or you could name your text frames like so and simplify the OnRecordStart code:

  • "Background A_1"
  • "Background A_2"
  • "Background A_3"
  • "Background A_4"
  • "Background B_1"
  • "Background B_2"
  • "Background B_3"
  • "Background C_1"
  • "Background C_2"
  • "Background C_3"
  • "Background D_1"
  • "Background D_2"
  • "Background D_3"
  • "Background D_4"
  • "Background D_5"
  • "Background D_6"

var trigger = Field("Postcard");
var versions = ['Background A', 'Background B', 'Background C', 'Background D'];
var maxFrames = 6; // Most frames any version has

while (maxFrames--)
   versions.forEach(function(s){ try { FindTextFrame(s + '_' + maxFrames).suppress = s != trigger; } catch(e){}});

Link to comment
Share on other sites

Let me answer your specific question first:

Is there a way to suppress multiple text frames under three or more circumstances?

Sure. The logic basically comes down to calling FindTextFrame for each frame, which can be done in a loop if the frames are named appropriately. Then you set the suppress property of each frame to either true or false.

For example, Background A has 4 text frames at 345º, Background B has 3 text frames at 0º, Background C has 3 text frames at 0º(different locations than BG B), and Background D has 6 text frames at 90º. All of the text frames are in different locations from postcard to postcard.

Okay, so if you name the frames with a scheme such as A1, A2, A3, A4, B1, B2, B3, C1, C2, C3, and D1 through D6, then you can do something like this in OnRecordStart (where I'm assuming your data field name is "Layout"):

for (var layout = Asc('A'); layout <= Asc('D'); layout++)
{
   var layoutName = Chr(layout);
   for (var i = 1; i <= 6; i++)
   {
       try
       {
           var frame = FindTextFrame(layoutName + i);
           frame.suppress = ToUpper(Field("Layout")) == layoutName;
       }
       catch (e)
       {
       }
   }
}

Each text frame has a unique name. I tried to apply a Callback Rule but that didn’t work with more than 2 backgrounds.

I don't understand what you mean here by "a Callback Rule." All of the calls to FindTextFrame (or FindGraphicFrame) should be in the OnRecordStart rule. And it should work no matter how many backgrounds there are.

You could build it two different ways that I know of. The way I normally do this is to create text resources for the information needed in the text boxes and build switches on the same field you use for the backgrounds. This works well if your text is the same but in different locations on the different backgrounds.

That would work. You could also use Template pages and repeatable components.

Otherwise you could use an 8 page template and set-up each page as it was its own template and name the pages to correspond with a field in the data. Then have an OnRecord start rule that calls out that field to trigger which pages to use. This method makes the composition run much slower since it runs through all 8 pages for each record.

Yes, you can do this by simply naming your pages A, B, C, and D, setting them all to be Unused, and then your OnRecordStart becomes just this single line of code:

FusionPro.Composition.SetBodyPageUsage(Field("Layout"), true);

Or if you have two sides for each postcard, name the pages something like "A front", "A back", "B front", etc, and do this:

FusionPro.Composition.SetBodyPageUsage(Field("Layout") + " front", true);
FusionPro.Composition.SetBodyPageUsage(Field("Layout") + " back", true);

The other thing you could do, in FusionPro Server or Producer, is to move the frames by setting their x and y properties, and possibly resize them by setting their width and height properties, or even rotate them by setting the rotationAngle property, or any other property to modify their appearance. With this workflow, you could set up a completely abstract variable layout template, where you set the positions of all the frames programatically in JavaScript. Then you only need one template, and you just have to know where to position each text frame for each version of your postcard. You could also emulate this without a Server or Producer license, by varying the position of text on the page using tables.

Recently, we had a job using 4 different postcards (all 2-sided) using the same data file. We did this for the presorted postal rates. We needed to keep all of the records in sequential order despite the fact that they use different artwork backgrounds.

I can't get into too many details, but I can tell you that an upcoming version of FusionPro Server will allow you to do exactly this: compose output from completely different FusionPro templates, from a single pre-sorted data file, and impose the composed records in the sorted order in the output, without having to write code to suppress or move frames or pages.

Link to comment
Share on other sites

I can't get into too many details, but I can tell you that an upcoming version of FusionPro Server will allow you to do exactly this: compose output from completely different FusionPro templates, from a single pre-sorted data file, and impose the composed records in the sorted order in the output, without having to write code to suppress or move frames or pages.

 

That is quite interesting. Look forward to hear more about this!

Link to comment
Share on other sites

Thank you everyone for your help.

 

I've tried several suggestions from this post and I think using a multipage template with the OnRecordStart code:

FusionPro.Composition.SetBodyPageUsage(Field("Layout") + " front", true);

FusionPro.Composition.SetBodyPageUsage(Field("Layout") + " back", true);

...is the most efficient option for what our company does. There are simply too many possible outcomes with all the various text frames in our combined data packages that trying to manage the locations through the other code could become messy over time.

 

And to clarify, I was using the "OnRecordStart" rule as my "Callback" rule. Sorry to leave out that specific detail.

 

I do have one more problem that I'm running into using the multipage template, however. The field in the data that I need to use to pull in each page isn't (nor can it be) an exact match for the page in the template.

 

The field I'm using is called "CODE." The code contains a job number and a record specific code number, all combined into one number. (Example: "GY3A99"..."GY3A" being the job number and "99" being the specific code number)

 

The job number is what I want to use to pull in the correct page of the template. How could I adjust my OnRecordStart code to do this?

 

I tried applying ".indexOf" to the code but that didn't work.

Link to comment
Share on other sites

The field I'm using is called "CODE." The code contains a job number and a record specific code number, all combined into one number. (Example: "GY3A99"..."GY3A" being the job number and "99" being the specific code number)

 

The job number is what I want to use to pull in the correct page of the template. How could I adjust my OnRecordStart code to do this?

 

I tried applying ".indexOf" to the code but that didn't work.

 

Yeah I think you would still be able to pull this off but it would be easier to answer if I knew a little bit more about how the two codes were concatenated. I'm assuming that the "specific code number" is a sequence number? Is that number formatted to two digits and or is the job number always 4 digits?

 

If the first 4 digits of the "CODE" field is what you based the names of your body pages on, you can use the "Left" function to only capture the first 4 characters on the left:

var pg = Left(Field("CODE"), 4);
FusionPro.Composition.SetBodyPageUsage(pg + " front", true);
FusionPro.Composition.SetBodyPageUsage(pg + " back", true);

 

Or you could use a RexExp to try and match any of your pages at the beginning of the "CODE" field:

var pgs = ['GY3A','AN07','H3r','c0d3']; // Your Page Codes
var pg = Field("CODE").match(new RegExp('^' + pgs.join('|'), 'i' ));

FusionPro.Composition.SetBodyPageUsage(pg + " front", true);
FusionPro.Composition.SetBodyPageUsage(pg + " back", true);

 

But again, I could probably offer a more helpful solution if I had a little bit more information about those codes and how they relate to your template. But generally speaking, if there is something unique about that string that allows you to determine which version to use, there's typically a way to write some code to parse that information out.

Link to comment
Share on other sites

Thank you, step!

 

Adding the first 4 characters on the left worked perfectly. And it makes sense. The first 4 characters are always the job number and that's the way I named the pages in the template.

 

I really appreciate all of the help.

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