Go Back   PTI Marketing Technologies User Community > Support > Digital Workflow Documents

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 1st, 2017, 07:29 AM
CCS_Printing CCS_Printing is offline
Junior Community Member
 
Join Date: Feb 2011
Posts: 33
Default Page Usage if/then problem

Acrobat 10
Fusion 9.3.15
Mac OS 10.11.6

I'm using FusionPro.Compositio.SetBodyPageUsage in combination with FusionProResource to use or not use a page and call back a resource if used.
I also have an array to make each section even and then make the complete document divisible by 4. ( which works great ) My problem is I need a pretty simple rule to use a particular page only if one or more of a range of variables are used-otherwise it remains not used. (which I can do -- But it breaks my array for each section being even and the complete document divisible by 4)

Here is my OnRecordStart

For setpageusage and array

Code:
if (Field("Opt1") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("How Plan works at renewal 042821", "true");
    }
if (Field("Opt2") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("HSA w_CYC 042825", "true");
    }
if (Field("Opt3") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("HSA_wo_CYC 042826", "true");
    }
if (Field("Opt4") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Highlights- EasyChoice A 042531", "true");
    }
if (Field("Filler1") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Filler1_042861", "true");
    }
if (Field("Filler2") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Filler2_042862", "true");
    }
if (Field("Filler3") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Filler3_042863", "true");
    }
if (Field("Opt5") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Highlights- EasyChoice B 042532", "true");
    }
if (Field("Opt6") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Highlights-Basic 042533", "true");
    }
if (Field("Opt7") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Highlights-Plan 2 042536", "true");
    }
if (Field("Opt8") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Highlights-Plan 3 042537", "true");
    }
if (Field("Opt9") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Highlights-Plan 5 042535", "true");
    }
if (Field("Opt10") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Highlights-Plan QDHP 042534", "true");
    }
if (Field("Opt11") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Highlights-Beffore Enrolling in QDHP 042827", "true");
    }
if (Field("Opt12") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Dental Plan divider page 042822", "true");
    }
if (Field("Opt13") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Dental Plan A 042543", "true");
    }
if (Field("Opt14") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Dental Plan B 042544", "true");
    }
if (Field("Opt15") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Dental Plan C 042545", "true");
    }
if (Field("Opt16") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Dental Plan PPO 042547", "true");
    }
if (Field("Opt17") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Ortho Plan A 042802", "true");
    }
if (Field("Opt18") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Ortho Plan B 042803", "true");
    }
if (Field("Opt19") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Ortho Plan C 042804", "true");
    }
if (Field("Opt20") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Ortho Plan D 042805", "true");
    }
if (Field("Opt21") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Ortho Plan E 042806", "true");
    }
if (Field("Opt22") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Ortho Plan F 042807", "true");
    }
if (Field("Opt23") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Ortho Plan G 042808", "true");
    }
if (Field("Opt24") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Ortho Plan H 042809", "true");
    }
if (Field("Opt25") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Ortho Plan I 042810", "true");
    }
if (Field("Opt26") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Vision Plan divider page 042823", "true");
    }
if (Field("Opt27") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Vision Plan A 042538", "true");
    }
if (Field("Opt28") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Vision Plan B 042539", "true");
    }
if (Field("Opt29") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Vision Plan C 042540", "true");
    }
if (Field("Opt30") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Vision Plan D 042546", "true");
    }
if (Field("Opt31") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Vision Plan E 042541", "true");
    }
if (Field("Opt32") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("Vision Plan F 042542", "true");
    }
if (Field("Opt33") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("App ******* Only 042669", "true");
    }
if (Field("Opt34") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("App ******* and Vision 042668", "true");
    }
if (Field("Opt35") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("App ******* and Dental 042824", "true");
    }
if (Field("Opt36") != "")
    {
    FusionPro.Composition.SetBodyPageUsage("App ******* Dental and Vision 042641", "true");
    }
    
    
    
    
    
    var pages = 21; // Number of static pages
var endPages = ['Filler3_042863','Notes Filler Page']; // Names of the Filler Pages at the end

// there are four sections this is whether each section
// should be odd or even
var mustBeEven = [true,false];

// Sections (Named in accordance to their "filler" page)
sections = {
    'Filler1_042861': [
        Field("Opt1"), 
        Field("Opt2"), 
        Field("Opt3"), 
       
        
    ], 
    'Filler2_042862': [
        Field("Opt4"),
        Field("Opt5"),
        Field("Opt6"),
        Field("Opt7"),
        Field("Opt8"),
        Field("Opt9"),
        Field("Opt10"),
        Field("Opt11"),
        Field("Opt12"),
        Field("Opt13"),
        Field("Opt14"),
        Field("Opt15"),
        Field("Opt16"),
        Field("Opt17"),
        Field("Opt18"),
        Field("Opt19"),
        Field("Opt20"),
        Field("Opt21"),
        Field("Opt22"),
        Field("Opt23"),
        Field("Opt24"),
        Field("Opt25"),
        Field("Opt26"),
        Field("Opt27"),
        Field("Opt28"),
        Field("Opt29"),
        Field("Opt30"),
        Field("Opt31"),
        Field("Opt32"),
        Field("Opt33"),
        Field("Opt34"),
        Field("Opt35"),
        Field("Opt36"),


    ],

};


var isEven = function (number) {
    return number % 2 === 0;
};

var currentSection = 0;
var i;
var pgCount;
for (i in sections) { 
    pgCount = 0;
    sections[i].filter(String).forEach(function(s){     
        pgCount += CreateResource(s, 'graphic').countPages;
    });
    pages += pgCount;
    
    Print("Section processed pages " + i);
    Print(pgCount);
    
    
    
    var addPage = mustBeEven[currentSection] && !isEven(pgCount);
    addPage = addPage || (!mustBeEven[currentSection] && isEven(pgCount));
    
    if (addPage) {
    
            FusionPro.Composition.SetBodyPageUsage(i, pages++);
    }
    
    currentSection++;
}


Print("pages:");
Print(pages);

var pagesNeeded = 4 - ((pages % 4) || 4);

Print("pagesNeeded");
Print(pagesNeeded);

var pagesAdded = 0;

while (pagesNeeded--){

    FusionPro.Composition.SetBodyPageUsage(endPages[pagesNeeded%2], true); 
    pagesAdded++;
    

}

Print("pagesAdded");
Print(pagesAdded);
Here is an example of the graphic call back rule

Code:
var Pic = new FusionProResource(Field("Opt12"), "graphic", "true");



if (Field("Opt12") != "")
            {

                return Pic
                            }
Any help would be greatly appreciated
__________________
OSX 10.10.5
Acrobat 10.1.16
FusionPro 9.3.15
Reply With Quote
  #2  
Old August 1st, 2017, 12:45 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 3,956
Default Re: Page Usage if/then problem

This is too hard to try to sort through in the abstract, without having the template files.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@pti.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@PTI.com. Paid consulting work may be required to fulfill your template-building needs. Please do not post proprietary font files to this forum.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:50 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.