Jump to content

On Record Start Multiple Pages based on single selection


web2print

Recommended Posts

Hello,

 

 

I have a job where there are going to be 165 choices each with a front and back page. It will be set up as a multi-select checkbox in MarcomCentral and they can select whichever designs they want.

 

 

 

I have a current product available that uses the same logic but is only populating one page based on a selection. The code for this rule is below:

 

 

var Design = Field("Design Name");
var designArray = [];
designArray = Design.split('|');
var results = [];

for (i=0;i<designArray.length;i++){
   FusionPro.Composition.SetBodyPageUsage(designArray[i], true);
}

 

What I would like to avoid is calling out each option in the rule like below:

if(Field("Version") == "Design1")
{
       FusionPro.Composition.SetBodyPageUsage("Design1", true)
       FusionPro.Composition.SetBodyPageUsage("Design2", false)
       FusionPro.Composition.SetBodyPageUsage("Design3", false)
}

else if(Field("Version") == "Design2")
{
       FusionPro.Composition.SetBodyPageUsage("Design1", false)
       FusionPro.Composition.SetBodyPageUsage("Design2", true)
       FusionPro.Composition.SetBodyPageUsage("Design3", false)
}

else if(Field("Version") == "Design3")
{
       FusionPro.Composition.SetBodyPageUsage("Design1", false)
       FusionPro.Composition.SetBodyPageUsage("Design2", false)
       FusionPro.Composition.SetBodyPageUsage("Design3", true)
}

If there a way to modify that first code snippet to display both pages for the design if I name the pages something like "Design1 - Page1" and "Design1 - Page2" or "D1 - P1" and "D1 - P2"?

 

 

Appreciate any assistance or guidance

Link to comment
Share on other sites

What I would like to avoid is calling out each option in the rule like below:

if(Field("Version") == "Design1")
{
       FusionPro.Composition.SetBodyPageUsage("Design1", true)
       FusionPro.Composition.SetBodyPageUsage("Design2", false)
       FusionPro.Composition.SetBodyPageUsage("Design3", false)
}

else if(Field("Version") == "Design2")
{
       FusionPro.Composition.SetBodyPageUsage("Design1", false)
       FusionPro.Composition.SetBodyPageUsage("Design2", true)
       FusionPro.Composition.SetBodyPageUsage("Design3", false)
}

else if(Field("Version") == "Design3")
{
       FusionPro.Composition.SetBodyPageUsage("Design1", false)
       FusionPro.Composition.SetBodyPageUsage("Design2", false)
       FusionPro.Composition.SetBodyPageUsage("Design3", true)
}

Right, you definitely don't want to do that, especially since, if you set all the pages to be Unused initially in the Page Usage dialog, all of that is basically equivalent to this single line:

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

If there a way to modify that first code snippet to display both pages for the design if I name the pages something like "Design1 - Page1" and "Design1 - Page2" or "D1 - P1" and "D1 - P2"?

It's the same as the one-liner, but with two lines:

FusionPro.Composition.SetBodyPageUsage(Field("Version") + " - Page1", true);
FusionPro.Composition.SetBodyPageUsage(Field("Version") + " - Page2", true);

Or, if the field value has multiple designs, delimited with pipe characters, as in your first snippet:

var Design = Field("Design Name");
var designArray = [];
designArray = Design.split('|');
for (i=0;i<designArray.length;i++){
   FusionPro.Composition.SetBodyPageUsage(designArray[i], true);
}

Then doing that for two pages would look something like this:

var designArray = Field("Design Name").split('|');
for (var i in designArray)
{
   FusionPro.Composition.SetBodyPageUsage(designArray[i] + " - Page1", true);
   FusionPro.Composition.SetBodyPageUsage(designArray[i] + " - Page2", true);
}

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