Jump to content

Landisa

Registered Users - Approved
  • Posts

    31
  • Joined

Posts posted by Landisa

  1. That does seem like the correct tag. Are you sure that corresponds to the output? Could there be another table cell with the same number?

     

    Perhaps you have tag such as <span color=Black> outside of the table, which is keeping the color fixed. I would try moving the table to another frame.

     

    I would also try reducing the problem to a minimal example; for instance, does a simple table with a single cell have the same problem? If not, try adding the rest back in until you find what triggers it.

     

    Well, the log file is great, but I'm still looking at this through a keyhole. If you want to attach the collected job, I might be able to look at it.

     

    Dan, I wasn't sure what part would help you the best so I have attached the complete composition folder. I did find and correct the graphic frame issue.

     

    I will try removing rows and cells to reduce the number of possibilities.

    I have tried deleting and rebuilding the Text Frame without success.

    1504112274.zip

  2. The first question I always ask in situations like this is, are there any messages about colors in the composition log (.msg) file?

     

    I am not sure I understand the message in the box but I see this for all of the records and the only one not composing correctly are on Sheet #6

    Composing record #54, input record 54
       Sheet #6, record #1
    No value associated to graphic copyhole <SetGraphic_Temp_1> in record 54.
    

     

    The next thing is, try looking at the actual tags generated. I would add this line right before the ending "return BoxSet" line:

    Print(BoxSet);

    Then look in the .msg file to see whether the tags look right.

     

    This seems to help a bit more when compared to the other template that works the output code is identical. Here is the code snippet on the area that is still showing black:

    Composing record #54, input record 54
       Sheet #6, record #1
    No value associated to graphic copyhole <SetGraphic_Temp_1> in record 54.
    <table alignment=right columns=5>
    
    [sNIPPED]
    
    <cell margins=Top:0;Bottom:0;Left:0;Right:0>
    <p br=false quad="R"><p br=false cellalignment="Bottom">
    <span><color name="White">125</span>
    

     

    So yeah the tag definitely looks correct. This is the number that is showing up black when it needs to be white.

     

    If you want I can always attach the .msg files if you think it will help.

  3. I really didn't want to post this but after hours of searching I couldn't find a reason.

     

    I have two templates that use this code. One of the templates refuses to turn the text of the table white.

     

    I have:

    • Made the made Variable in the Text Frame as White text
    • I have edited my Table rule so both outcomes show as White
    • I have edited the outcome for other variables other than "RED" and they work
    • I have rewritten the code so not RED would be Black
    • Tried seeing if it composed properly even if preview was bad (didn't work)

     

    However, no matter what I have done the code still shows black text on a dark colored background. Here is my code:

     

    var tbl = [];
    var myTable = new FPTable;
    myTable.AddColumns(3000, 3000, 3000, 3000, 3000);
    
    if (Field("RUN COLOR") == "RED")
    {
       //Formatting the table
       for (var i=0; i<2; i++)
       {
           var row = myTable.AddRow();
           var cell = row.Cells[0];
    
           cell.Margins = new FPTableMargins;
           cell.Margins = {Bottom: 0, Top: 0, Left: 0, Right: 0};
    
           //cell.SetBorders("Thin", "Black", "Top", "Right", "Bottom", "Left");
           cell.HAlign = "Right";
           cell.VAlign = "Bottom";
           cell.TextColor = "White";
           row.CopyCells(0,1,2,3,4);
           row.minHeight = 800;
       }
    }
    else
    {
       //Formatting the table
       for (var i=0; i<2; i++)
       {
           var row = myTable.AddRow();
           var cell = row.Cells[0];
    
           cell.Margins = new FPTableMargins;
           cell.Margins = {Bottom: 0, Top: 0, Left: 0, Right: 0};
    
           //cell.SetBorders("Thin", "Black", "Top", "Right", "Bottom", "Left");
           cell.HAlign = "Right";
           cell.VAlign = "Bottom";
           cell.TextColor = "Black";
           row.CopyCells(0,1,2,3,4);
           row.minHeight = 800;
       }
    }
    
    //Insert Data into Rows
    myTable.Rows[0].SetContents("<color name=\"White\">" + Field("BOX09"), Field("BOX07"), Field("BOX05"), Field("BOX03"), Field("BOX01")); //Row 1
    myTable.Rows[1].SetContents(Field("BOX10"), Field("BOX08"), Field("BOX06"), Field("BOX04"), Field("BOX02")); //Row 2
    
    BoxSet = myTable.MakeTags().replace(/^\<table/, "<table alignment=right");
    
    return BoxSet;
    

     

    If it is helpful to know this code slightly varies from the other template that does work. Here is that code:

     

    var tbl = [];
    var myTable = new FPTable;
    myTable.AddColumns(3100, 3100, 3100, 3100);
    
    if (Field("RUN COLOR") == "RED")
    {
       //Formatting the table
       for (var i=0; i<3; i++)
       {
           var row = myTable.AddRow();
           var cell = row.Cells[0];
    
           cell.Margins = new FPTableMargins;
           cell.Margins = {Bottom: 0, Top: 0, Left: 0, Right: 0};
    
           //cell.SetBorders("Thin", "Black", "Top", "Right", "Bottom", "Left");
           cell.HAlign = "Right";
           cell.VAlign = "Bottom";
           cell.TextColor = "White";
           row.CopyCells(0,1,2,3);
           row.minHeight = 1200;
       }
    }
    else
    {
       //Formatting the table
       for (var i=0; i<3; i++)
       {
           var row = myTable.AddRow();
           var cell = row.Cells[0];
    
           cell.Margins = new FPTableMargins;
           cell.Margins = {Bottom: 0, Top: 0, Left: 0, Right: 0};
    
           //cell.SetBorders("Thin", "Black", "Top", "Right", "Bottom", "Left");
           cell.HAlign = "Right";
           cell.VAlign = "Bottom";
           cell.TextColor = "Black";
           row.CopyCells(0,1,2,3);
           row.minHeight = 1200;
       }
    }
    
    //Insert Data into Rows
    myTable.Rows[0].SetContents(Field("BOX10"), Field("BOX07"), Field("BOX04"), Field("BOX01")); //Row 1
    myTable.Rows[1].SetContents(Field("BOX11"), Field("BOX08"), Field("BOX05"), Field("BOX02")); //Row 2
    myTable.Rows[2].SetContents(Field("BOX12"), Field("BOX09"), Field("BOX06"), Field("BOX03")); //Row 3
    
    BoxSet = myTable.MakeTags().replace(/^\<table/, "<table alignment=right");
    
    return BoxSet;

     

    If someone could just guide me to what is causing this issue of being black all the time regardless of the Rules or what is set in the Text Frame, I would appreciate it.

     

    It may be possible I am just missing something small but it absolutely does not change to White if the background frame is Red.

  4. Nevermind! I just had to eat some breakfast.

     

    I used your book separating method and changed the couponNumber rule:

     

    Old Rule

    var strNumber = "<b><z newsize=10>N<z newsize=14><u><superscript>o</superscript></u><z newsize=12> </b>";
    
    FusionPro.Composition.composeAllRecords = false; 
    FusionPro.Composition.startRecordNumber = Field("start #"); 
    FusionPro.Composition.endRecordNumber = Field("# of coupons"); 
    FusionPro.Composition.repeatRecordCount = Field("# of coupons");
    
    return strNumber + FormatNumber ("0000", FusionPro.Composition.recordNumberInChunk);

     

    New Rule

    var strNumber = "<b><z newsize=10>N<z newsize=14><u><superscript>o</superscript></u><z newsize=12> </b>";
    
    FusionPro.Composition.composeAllRecords = false; 
    FusionPro.Composition.startRecordNumber = Field("start #"); 
    FusionPro.Composition.endRecordNumber = Field("# of coupons"); 
    FusionPro.Composition.repeatRecordCount = Field("# of coupons");
    
    return strNumber + FormatNumber ("0000", FusionPro.Composition.repeatRecordNumber);
    

     

    By changing it from recordNumberInChunk to repeatRecordNumber, it kept the sequence set number per Ranch but continued to break correctly between books.

     

    Thanks! ^^,

  5. Or is the number of coupons per chunk variable? If so, then you just need to change the condition here:

    if (FieldChanged("BMA Name") && FusionPro.Composition.repeatRecordNumber == 1)
       FusionPro.Composition.OpenNewOutputFile(jobNumber + jobExtension);

    To something like this:

    if (FieldChanged("BMA Name") || FusionPro.Composition.repeatRecordNumber % couponPerBook == 1)
    {
       var couponPerBook = Field("# of coupons/book");
       var jobNumber = Field("Job #") + "_" + Field("BMA Name") + "_Book" + Int((FusionPro.Composition.repeatRecordNumber-1) / couponPerBook);
       var jobExtension = "." + (FusionPro.Composition.outputFormatExtension || "pdf");
       FusionPro.Composition.OpenNewOutputFile(jobNumber + jobExtension);
    }
    

     

    Yes, the chunks are a variable. I was happy with how this worked but the coupons don't continue the count after the book is output.

     

    So now I see:

    Job#_Ranch1_Book0     2000 coupons     (1-2000)
    Job#_Ranch1_Book1     2000 coupons     (1-2000)

     

    What I was hoping for was to continue the numbering sequence:

    Job#_Ranch1_Book0     2000 coupons     (1-2000)
    Job#_Ranch1_Book1     2000 coupons     (2001-4000)

     

    Is there a way to keep the numbering sequential?

  6. So we are trying to find a better way to run several hundred different coupon stacks. The customer wants the coupons stacked in "books" based on the number of coupons per book.

     

    Here are the codes I have:

     

    OnJobStart

    FusionPro.Composition.chunksBreakStacks = true;

     

    OnRecordStart

    var jobNumber = Field("Job #") + "_" + Field("BMA Name");
    var jobExtension = "." + (FusionPro.Composition.outputFormatExtension || "pdf");
    
    if (FieldChanged("BMA Name") && FusionPro.Composition.repeatRecordNumber == 1)
       FusionPro.Composition.OpenNewOutputFile(jobNumber + jobExtension);

     

    couponNumber

    var strNumber = "<b><z newsize=10>N<z newsize=14><u><superscript>o</superscript></u><z newsize=12> </b>";
    var bookCount = Field("# of books");
    var couponPerBook = Field("# of coupons/book"); 
    
    FusionPro.Composition.composeAllRecords = false; 
    FusionPro.Composition.startRecordNumber = Field("start #"); 
    FusionPro.Composition.endRecordNumber = Field("end #"); 
    FusionPro.Composition.repeatRecordCount = Field("# of coupons"); 
    
    return strNumber + FormatNumber ("0000", FusionPro.Composition.recordNumberInChunk);

     

    This works great for stacking our coupons for each Ranch.

    However, we now need to use the # of coupons/book to break up each part into a new book.

    Example: Currently we see

    Job#_Ranch1.pdf     (4000 coupons 1-4000)
    Job#_Ranch2.pdf     (6000 coupons 1-6000)

     

    What we are looking for are smaller chunks based on number of records per book and number of books or total number of coupons.

    Example: We want to see

    Job#_Ranch1_Book1     (2000 coupons 1-2000)
    Job#_Ranch1_Book2     (2000 coupons 2001-4000)
    Job#_Ranch2_Book1     (1000 coupons 1-1000)
    Job#_Ranch2_Book2     (1000 coupons 1001-2000)
    Job#_Ranch2_Book3     (1000 coupons 2001-3000)
    Job#_Ranch2_Book4     (1000 coupons 3001-4000)
    Job#_Ranch2_Book5     (1000 coupons 4001-5000)
    Job#_Ranch2_Book6     (1000 coupons 5001-6000)

     

    I have tried a few things, including for loops, extra if statements and while loops. So far I have been unsuccessful at getting the result we need.

     

    I am assuming we need a variable "bookCount" to increase after each set so it doesn't overwrite the previous set.

     

    Attached is the original code before the OnRecordStart was updated for you to work with.

     

    Suggestions?

    BMA Sample Coupons.zip

  7. I have a set of coupons that number down the sheet.

    They start at the number field (start #).

    They need to have coupons total of (# of coupons).

    They need to end, chunk a file and begin with the next field and new start number.

    There is an imposition of 4Up and that part is working beautifully.

     

    In my rules everything is working EXCEPT the numbers won't restart at #1 and continue from the previous file stack.

     

    Attached is a sampling of the code, FusionPro file, and imposition if anyone wants to try to see what I mean.

     

    Here are my rules:

     

    OnJobStart

    FusionPro.Composition.chunksBreakStacks = true;
    

     

    OnRecordStart

    if (FieldChanged("BMA Name") && FusionPro.Composition.repeatRecordNumber == 1)
       FusionPro.Composition.OpenNewOutputFile(Field("Job #") + "_" + Field("BMA Name") + "." + FusionPro.Composition.outputFormatExtension);
    

     

    couponNumber

    var strNumber = "<b><z newsize=10>N<z newsize=14><u><superscript>o</superscript></u><z newsize=12> </b>";
    
    var bookCount = Field("# of books");
    var couponPerBook = Field("# of coupons/book"); 
    var totalCoupons = Field("# of coupons") 
    
    FusionPro.Composition.composeAllRecords = false;
    FusionPro.Composition.startRecordNumber = Field("start #");
    FusionPro.Composition.endRecordNumber = Field("end #");
    FusionPro.Composition.repeatRecordCount = totalCoupons; 
    
    return strNumber + FormatNumber ("0000", CurrentRecordNumber());

     

    The Books should stack by Ranch name after coupons complete. Example Ranch 1 has 4000 coupons number 0001-4000 and Ranch 2 has 6000 coupons number 0001-6000.

     

    My first book should look like:

    Ranch Name     No. 0001
    Ranch Name     No. 0002
    Ranch Name     No. 0003
    Ranch Name     No. 0004
    .....
    Ranch Name     No. 3997
    Ranch Name     No. 3998
    Ranch Name     No. 3999
    Ranch Name     No. 4000

     

    The second book should look like:

    Ranch Name     No. 0001
    Ranch Name     No. 0002
    Ranch Name     No. 0003
    Ranch Name     No. 0004
    .....
    Ranch Name     No. 5997
    Ranch Name     No. 5998
    Ranch Name     No. 5999
    Ranch Name     No. 6000

     

    However, the books are stacking by Ranch name after # coupons complete but not restarting the sequence. Example Ranch 1 has 4000 coupons number 0001-4000 and Ranch 2 has 6000 coupons number 4001-10000.

     

    Ranch Name     No. 0001
    Ranch Name     No. 0002
    Ranch Name     No. 0003
    Ranch Name     No. 0004
    .....
    Ranch Name     No. 3997
    Ranch Name     No. 3998
    Ranch Name     No. 3999
    Ranch Name     No. 4000

    Ranch Name     No. 4001
    Ranch Name     No. 4002
    Ranch Name     No. 4003
    Ranch Name     No. 4004
    .....
    Ranch Name     No. 9997
    Ranch Name     No. 9998
    Ranch Name     No. 9999
    Ranch Name     No. 10000

     

    Can someone tell me what code I am missing or what I did to cause it not to start a new numbering set on each new ranch output?

    BMA Sample Coupons.zip

  8. I had to do this as well for a name badge scenario but it took some testing to make sure it was just right. I made a new Empty JavaScript rule for each line.

     

    In my text frame I have:

    «First_CopyFit»

    «LastName_CopyFit»

    «Organization»

     

    The last names seemed to be longer than the others so I will provide the code for the LastName_CopyFit rule I created.

     

    //this JavaScript will apply all cap formatting to the "Last"  field.
    var uppercaseLast = ToUpper(Field("Last"));
    
    //this checks for syntax in the string.
    var hyphenCheck = uppercaseLast.indexOf("-");
    var spaceCheck = uppercaseLast.indexOf(" ");
    var lineCheck = uppercaseLast.indexOf("~");
    
    //If syntax exists use uppercase, correct syntax and fit it to line.
    //No static text, use break from IF/ELSE, based on specific font from list, 
    //make the base font 24 points, width of space 125 points and minimum 
    //of 48 points (did not adjustWidthOnly true/false). 
    //Check for hyphens and split the hyphenated name onto a new line
    if (hyphenCheck >=1)
    {
       var addBreak = uppercaseLast.replace("-", "-<br>")
       return CopyfitLine("", addBreak, "Myriad Pro Cond", 48, 125, 24);
    }
    //Check for a space and make sure that it doesn't break to a new line
    else if (spaceCheck >=1)
    {
       var addSpace = uppercaseLast.replace(" ", " ")
       return CopyfitLine("", addSpace, "Myriad Pro Cond", 48, 125, 24);
    }
    //Check for a line break designated as tilde and change to break       
    else if (lineCheck >=1)
    {
       var addLine = uppercaseLast.replace("~", "<br>")
       return CopyfitLine("", addLine, "Myriad Pro Cond", 48, 125, 24);
    }
    
    else
    {
       return CopyfitLine("", uppercaseLast, "Myriad Pro Cond", 48, 125, 24);
    }
    

     

    With this I noticed that the "font name" wasn't exactly as it was listed in my fonts so I used what was listed in FusionPro.

     

    Also, the font sizing works best if you check the longest line and the shortest line for the best fit and adjust the numbers as needed.

     

    This is the original thread I used to help get me started:

    http://forums.pti.com/showthread.php?t=1712

  9. I need a sheet of coupons that cycle through the list of coupons in a data file.

    These coupons are 5 up and 3 across. They will need to continue if the group of coupons goes beyond 15 and continue until the data file runs out of records.

     

    I am using Repeatable Components instead of Imposition because the Data Sheet name needs to be at the bottom of each coupon group and later chunked out by Data Sheet name.

     

    I know how to code through items if using a key and external file but these don't really have any key items to go off of and some items may repeat themselves if there are multiple copies listed in the Data File.

     

    I need help getting this file to display one copy of each record. Right now it displays a copy for the first record multiple times based on the "i <= #" part. The records really should loop until the end without me having to list a number.

     

    Attached are sample files. We usually use .csv files but I had to upload the file as a .txt so you will need to relink the data file.

     

    I'm only asking for guidance not a complete solution. I will continue to try to work through this on my own.

    Shelf_Tags.pdf

    BabyFood.txt

  10. Well, in Preview, it's only actually processing a single record of data, so the "FieldChanged" will always return false, since there's no previously processed record to compare the current record's field value to.

     

    This should work, though:

     if (FieldChanged("KEY1") || IsPreview())

     

    Awesome! This works like a charm!

     

    Mostly just need to make sure the fields are populating.

    If the preview doesn't show the "FieldChanged" correctly but still runs on the server without issues, we are good to go!

     

    Thanks again for the help! ^^,

  11. I have a form with a key file that can have multiple keys.

    My goal is to add code prevent creating multiple copies of the form based on if the field has the same key as previous.

     

    Example:

    KEY1 KEY2

    312456 103489

    312456 504723

    312456 654871

     

    My form already turns on when it finds the field that matches it:

     if (Field("Letter_Code") == "010")
    {
         FusionPro.Composition.SetBodyPageUsage("Letter_010", true);
     }

     

    I was thinking of using the FieldChanged rule and composeThisRecord rule to help prevent creating multiple letters since they KEY1 is the one we are basing the code from even though we need both keys for different table pulls.

     

    My code ended up being like:

        FusionPro.Composition.composeThisRecord = false;
       if (FieldChanged(Field(KEY1")))
       {
          FusionPro.Composition.composeThisRecord = true;
       }

     

    OR

        if (FieldChanged(Field("KEY1")))
       {
          FusionPro.Composition.SetBodyPageUsage("Letter_010", true);
        }

     

    However, when I run this code it turns the whole form unrenderable.

     

    Am I using this code incorrectly?

    Any suggestions?

     

    If requested I can mock up a new file for viewing due to the sensitive nature of the form.

  12. My reporting form has been modified this year and I was trying out some new code that was a lot more condensed than my previous code.

     

    However, it seems that the data table does not create a new one for each property but makes doubles and extras of the first table.

     

    Can someone look at the code and forms and see what I missed?

    I thought it had to do with clearing the data array but I can't figure out where I am running into trouble (probably because I have been staring at this code for weeks now). Any help would be greatly appreciated!

     

    //Link to the external data file.  
    //The '\t' is used to indicate TAB delimited data in this external data file
    data = new ExternalDataFileEx("property.txt", "\t");
    
    if (!data.valid)
    {
      ReportError("Cannot successfully read/find the external data file.");
    }
    
    // Create empty
    var tables = [];
    var tbl = [];
    
    //Get a count of the total number of records in the external data file
    NumberOfRecords = data.recordCount;
    
    var type = [
       ['Horses', 'Horses, Mules and Asses (ponies, donkeys, burros)*', 5.85],
       ['Cattle','Cattle (cows, bulls, yearlings)*', 2.29],
       ['Bison','Domestic Bison*', 6.38],
       ['Sheep','Sheep*', 0.54],
       ['Swine','Swine (report all swine three months of age or older)', 0.78], 
       ['Goats','Goats*', 0.54],
       ['Poultry','Poultry (chickens, turkeys, geese, ducks and other domestic birds raised as food or to produce feathers)', 0.05],
       ['Bees','Bees (number of hives or boards)', 0.41],
       ['Domestic','Alternative Livestock (privately owned caribou, mule deer, whitetail deer, elk, moose, antelope, mountain sheep, mountain goats indigenous to Montana)*', 26.23],    
       ['Ratites','Ratites (ostriches, rheas, emus)*', 9.37],
       ['Llamas','Llamas and Alpacas*' , 9.37]
    ];
    
    //Now, loop through all records in the external data file and find the records that belong to the customer.
    for (var n = 1; n <= NumberOfRecords; n++) 
    {
       function ExField(field) { return data.GetFieldValue(n, field); }
    
       if (ExField("CID") == Field("Customer ID")) 
       {
    
           //Create Table
           var myTable = new FPTable;
    
           myTable.AddColumns(26500, 5800, 7500, 10800);
    
           tbl.push(["County: " + ExField("County Name"), "Property ID: " + ExField("Property ID"), "", ""]); // Title
           tbl.push(["Livestock Type", "A <br> Count", "B <br> Fee Amount", "C <br> Calculate Total"]); // Header
    
           type.forEach(function(s) 
           {
               var [field, description, price] = s;
               field = ExField(field);
               description = "<leading newsize = 120>" + description;
               price = "  x  " + FormatNumber('$00.00', price).replace('$0','$  ')+ " = ";
               tbl.push([description, '', price,'']);
           });
    
           // Footer
           tbl.push(["Add amounts in column C. <br><b>This is your total Per Capita Fee Amount due for this county.</b>", "", "", "<b>$</b>"]); 
    
           // Formatting 
           for (var i=0; i<tbl.length; i++) 
           {
               var row = myTable.AddRow();
               var cell = row.Cells[0];
    
               cell.PointSize = 11; 
               cell.Margins = new FPTableMargins;
               cell.Margins = {Bottom: 10, Top: 23, Left: 250, Right: 250};
               row.CopyCells (0,1,2,3);
               row.minHeight = 1500;
    
               myTable.ShadingColor1 = 'White';
               myTable.ShadingPct1 = 100;
               myTable.ShadingRepeat1 = 1;
               myTable.ShadingColor2 = 'Black 9%';
               myTable.ShadingPct2 = 100;
               myTable.ShadingRepeat2 = 1;
               myTable.ShadingType = 'ByRow'; //or “ByColumn”
    
               if (i == 0) 
               {
                   cell.VAlign = 'Bottom';
                   cell.Bold = 'On';  
               }
    
               if (i == 1) 
               {
                   cell.PointSize = 10;
                   cell.ShadeColor = "Brown";
                   cell.ShadePct = 100;
                   cell.TextColor = "White";
                   cell.HAlign = "Center";
                   cell.Bold = 'On';
                   cell.SetBorders("Thin", "Black 25%","Top", "Bottom", "Right", "Left");
                   row.minHeight = 3000;
                   row.CopyCells (0,1,2,3);
               }
    
               if (i > 1) 
               {
                   cell.Bold = 'Off';
                   cell.SetBorders("Thin", "Black 25%","Top", "Bottom", "Right", "Left");
                   cell.HAlign = "Left";
                   row.minHeight = 1500;
                   row.CopyCells (0,1,2,3);
               }
    
               if (i == 13) 
               {
                   cell.PointSize = 10;
                   cell.HStraddle = 3;
                   cell.HAlign = "Right"; 
               }
    
               cell.VAlign = 'Middle';
               row.CopyCells (0,1,2,3);
    
               //Assign the content
               var [col1,col2,col3,col4] = tbl[i];
               row.SetContents(col1,col2,col3,col4);
           }
    
           myTable.Rows[0].Cells[1].HStraddle = 3;
           myTable.Rows[13].Cells[3].HAlign = "Left";
    
           // Push variable into Array
           tables.push(myTable.MakeTags()); 
       }
    }
    return tables.join('<br>');

    Reporting Form 2017.zip

  13. I have a very complex file. Figured out how to get it to loop through entries and then display additional data tables if it found another User.

     

    However, each user needs a copy of their own page, not just a data table, with all of the same information and it needs to flow behind the other one. I am not sure what I need to make this happen.

     

    Attaching a sample set so everyone can view what I have already and work through solutions.

    Sample FPro.zip

  14. That isn't the composition log; that is the collection log. The composition log would likely be in the same place as your composed output file.

     

    Are you composing the output on a different machine than the one you're using to preview the template? I still think that the issue is that your template can't find your external data file at the time of composition. You can try adding an absolute path to your external data file:

     

    You are a genius! I forgot to add the external file as a Resource.

    Once I did that the composition worked! *facepalm*

     

    Yes, I am previewing the document on a separate machine then composition.

    Problem Solved!

  15. No errors were found on composition.

    ====================SUMMARY====================
    Collection Directory:
     C:\Users\AppData\Local\Temp\
    ------------------
    Composition files:
     C:\Users\Desktop\FusionPro\Passport Letter_FPro.pdf
     C:\Users\Desktop\FusionPro\caseworkers.csv
    Graphics resource files copied: 0
    ------------------
    Text resource files copied: 0
    ------------------
    Page media files copied: 0
    ------------------
    Imposition files copied: 0
    ------------------
    ------------------
    ------------------
    ------------------
    ------------------
    ------------------
    Following files are generated for server composition after collect.
    Data Definition File:
     Passport Letter_FPro.def
    DIF format file:
     Passport Letter_FPro.dif
    Configuration File:
     Passport Letter_FPro-o.cfg
    Unicode Font Files: 4
       C:\Users\Public\Documents\PTI\FusionPro\Fonts\Arial Italic-1.pfa
       C:\Users\Public\Documents\PTI\FusionPro\Fonts\Arial Bold Italic-1.pfa
       C:\Users\Public\Documents\PTI\FusionPro\Fonts\Arial Bold-1.pfa
       C:\Users\Public\Documents\PTI\FusionPro\Fonts\Arial-1.pfa
    

  16. Are you getting any errors in your message log? Like: "Cannot successfully read/find the external data file."?

     

    You could try just defining your data file within the rule itself rather than assigning it to a global variable in OnJobStart:

     

    I tried making that change. No success.

     

    As for the Message Log, I have no idea where to find it. I will go looking for it.

  17. [sOLVED]

     

    I am working on several items in this field including multiple possible body pages based on column value, overflow, and variable tables based on key customers and multi-row external data.

     

    My big issue right now is that my tables display on Preview but nothing shows up during Composition. I am assuming it is simple missed code or misplaced code on my behalf.

     

    OnRecordStart

    if (Field("MCE_Letter_Code") == "1")
    {
       FusionPro.Composition.SetBodyPageUsage("PP006", false);
       FusionPro.Composition.SetBodyPageUsage("PP006_2", false);
       FusionPro.Composition.SetBodyPageUsage("PP006_3", false);
       FusionPro.Composition.SetBodyPageUsage("PP006_Overflow",false);
       FusionPro.Composition.SetBodyPageUsage("PP009", false);
       FusionPro.Composition.SetBodyPageUsage("PP010", false);
       FusionPro.Composition.SetBodyPageUsage("PP026", false);
    }
    else if (Field("MCE_Letter_Code") == "6")
    {
       FusionPro.Composition.SetBodyPageUsage("PP001",false);
       FusionPro.Composition.SetBodyPageUsage("PP001_2",false);
       FusionPro.Composition.SetBodyPageUsage("PP001_Overflow",false);
       FusionPro.Composition.SetBodyPageUsage("PP009", false);
       FusionPro.Composition.SetBodyPageUsage("PP010", false);
       FusionPro.Composition.SetBodyPageUsage("PP026", false);
    }
    else if (Field("MCE_Letter_Code") == "9")
    {
       FusionPro.Composition.SetBodyPageUsage("PP001",false);
       FusionPro.Composition.SetBodyPageUsage("PP001_2",false);
       FusionPro.Composition.SetBodyPageUsage("PP001_Overflow",false);
       FusionPro.Composition.SetBodyPageUsage("PP006", false);
       FusionPro.Composition.SetBodyPageUsage("PP006_2", false);
       FusionPro.Composition.SetBodyPageUsage("PP006_3", false);
       FusionPro.Composition.SetBodyPageUsage("PP006_Overflow",false);
       FusionPro.Composition.SetBodyPageUsage("PP010", false);
       FusionPro.Composition.SetBodyPageUsage("PP026", false);
    }
    else if (Field("MCE_Letter_Code") == "10")
    {
       FusionPro.Composition.SetBodyPageUsage("PP001",false);
       FusionPro.Composition.SetBodyPageUsage("PP001_2",false);
       FusionPro.Composition.SetBodyPageUsage("PP001_Overflow",false);
       FusionPro.Composition.SetBodyPageUsage("PP006", false);
       FusionPro.Composition.SetBodyPageUsage("PP006_2", false);
       FusionPro.Composition.SetBodyPageUsage("PP006_3", false);
       FusionPro.Composition.SetBodyPageUsage("PP006_Overflow",false);
       FusionPro.Composition.SetBodyPageUsage("PP009", false);
       FusionPro.Composition.SetBodyPageUsage("PP026", false);
    }
    else if (Field("MCE_Letter_Code") == "26")
    {
       FusionPro.Composition.SetBodyPageUsage("PP001",false);
       FusionPro.Composition.SetBodyPageUsage("PP001_2",false);
       FusionPro.Composition.SetBodyPageUsage("PP001_Overflow",false);
       FusionPro.Composition.SetBodyPageUsage("PP006", false);
       FusionPro.Composition.SetBodyPageUsage("PP006_2", false);
       FusionPro.Composition.SetBodyPageUsage("PP006_3", false);
       FusionPro.Composition.SetBodyPageUsage("PP006_Overflow",false);
       FusionPro.Composition.SetBodyPageUsage("PP009", false);
       FusionPro.Composition.SetBodyPageUsage("PP010", false);
    }
    else
    {
    
    }
    return "";

     

    OnJobStart

    //Link to the external data file.  
    data = new ExternalDataFileEx("data_feed.csv", ",");
    
    if (!data.valid)
    {
      ReportError("Cannot successfully read/find the external data file.");
    }

     

    Rule_DataTable

    //The following if statement will detect if we are currently in preview mode or editing this rule (versus composing output).
    if(FusionPro.Composition.isPreview == true || FusionPro.inValidation == true)
    {
       Rule("OnJobStart");
    }
    
    //Create empty
    var table = [];
    var tbl = [];
    
    //Get a count of the total number of records in the external data file
    NumberOfRecords = data.recordCount;
    
    var type = 
    [
       [' '] //Header
    ];
    
    //Create Table
    var myTable = new FPTable;
    
    myTable.AddColumns(13000, 2000, 20000, 8500, 6500);
    
    tbl.push(["", "", "Provider Name", "Phone Number", "Miles Away"]); //Header Rows 
    
       //Now, loop through all records in the external data file and find the records
       for (var n=1; n<=NumberOfRecords; n++) 
       {
       function ExField(field) {return data.GetFieldValue(n, field);}
           if (Field("MCE_Case_Number") == ExField("Case_Number"))
           {
               type.forEach(function(s) 
               {
                 var [provider, phone, miles] = s; 
                   provider = ExField("Prov_Name");
                   phone = ExField("Prov_Phone").replace(/^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})$/, "($1) $2-$3");
                   miles = FormatNumber("0.0", ExField("Prov_Mileage")/100);
                   tbl.push(['Check to choose this provider', '', provider, phone, miles]);
               });
           }           
       }
    
      // Formatting
       for (var i=0; i<tbl.length; i++) 
       {
           var row = myTable.AddRow();
           var cell = row.Cells[0]; 
           row.minHeight = 2000; 
           cell.Margins = new FPTableMargins;
           cell.Margins.Bottom = 0;
           row.CopyCells (0,1,2,3,4);
           if (i >= 1) myTable.Rows[i].Cells[1].SetBorders ("Thin", "Black", "Top", "Bottom", "Right", "Left");
           if (i == 0) cell.HStraddle = 2;
           myTable.Rows[0].Cells[1].Bold = "On"; 
           cell.VAlign = "Middle";
           row.CopyCells (1,2,3,4);
           myTable.Rows[i].Cells[2].HAlign = "Left";
           myTable.Rows[i].Cells[3].HAlign = "Center";
           myTable.Rows[i].Cells[4].HAlign = "Right";
           var [col0, col1, col2, col3, col4] = tbl[i];
           row.SetContents (col0, col1, col2, col3, col4);
       } 
    myTable.AddRow(1); //Blank row for seperation
    
    //Push variable into Array
    table.push(myTable.MakeTags());
    
    return table;

     

    Text Frame

    If you want a doctor not listed in the chart below, write the name and city on the lines below.
    Name: 		
    City: 		
    
    «Rule_DataTable»
    Person completing this form: 	

     

    Again I get the results I need from preview but the composition file is well lacking the data table.

     

    Suggestions? Another set of eyes on my code helps a lot.

  18. your onJobStart should reference the total number of coupons only...

    var totalCoupons = 1875;  //Enter the number of total coupons
    
    FusionPro.Composition.composeAllRecords = false;
    FusionPro.Composition.startRecordNumber = 1;
    FusionPro.Composition.endRecordNumber = totalCoupons;

     

    your onRecordStart should be set to allow infinite stack to be set:

    FusionPro.Composition.chunksBreakStacks = true

     

    your serial # should use the system record # which is 1 and increment it by your starting coupon number:

    return CurrentRecordNumber()+69000;

     

    If you want to start at 69000, set 69000 to 68999.......or throw in a "-1" after the "69000" above.

     

    I think you can call global variables, but you'll need a onRecordEnd to increment it? I don't know global variables too well at this point. Sorry.

     

    Hopes this helps.

     

    Yes it does! This worked perfectly! Also, I didn't need the onRecordStart portion to get it to do what I needed it for. Thanks! ^^,

  19. Background: Simple coupons with sequential numbering set 4Up on a sheet.

     

    Problem: Sequential starting number works if I don't have "stack" set in the imposer. Once "stack" is set the starting number is disregarded and begins at 1.

     

    OnJobStart Code:

    var startNumber = 69000; //Enter the begin number provided.
    var totalCoupons = 1875;  //Enter the number of total coupons
    var endNumber = (startNumber + totalCoupons) - 1;  
    
    FusionPro.Composition.composeAllRecords = false;
    FusionPro.Composition.startRecordNumber = startNumber;
    FusionPro.Composition.endRecordNumber = endNumber; 
    

     

    Empty Rule Code (CouponNumber):

    return CurrentRecordNumber();

     

    FusionPro Imposer Settings:

    Simplex

    Stack Count 10000 OR Checked Infinite Stack

    Vertical Count 4 0" Spacing

     

    Goal: To have a coupon numbering system that did the counting down stack starting at a number other than 1

     

    Answer: Made suggested changes to OnJobStart code and EmptyRule code provided by tou in the second post. Thanks! ^^,

×
×
  • Create New...