Jump to content

jpmiller

Registered Users - Approved
  • Posts

    23
  • Joined

Posts posted by jpmiller

  1. That totalRecs variable is simply a number, not an array, so there's nothing to iterate over in a for loop.

     

    Thank you Dan. That helps. I was getting frustrated trying to figure out a formula that would loop through the totalRecs until zero. I understand my error now.

  2. Hi, I am trying to get the loop below to run through the record count and execute different results based on the quantity.

     

    The rule below never gets past the first if statement.

    Not sure what I am doing wrong. Any help would be appreciated.

     

    var nameFieldName = "first";

    var data = new ExternalDataFileEx(PrimaryInputFile());

    var totalRecs = data.recordCount;

     

    for (i = 0; i < totalRecs; i++) {

    if (totalRecs = 5000) {

    var recordsPerBox = (2500);

    } else if ((totalRecs > 2500) && (totalRecs < 5000)) {

    var recordsPerBox = Math.ceil(totalRecs / 2);

    } else (totalRecs < 2500) {

    var recordsPerBox = (totalRecs);

    }

    }

     

    var numBoxes = Math.ceil(totalRecs / recordsPerBox);

    FusionPro.Composition.repeatRecordCount = numBoxes;

    var boxNum = FusionPro.Composition.repeatRecordNumber;

    var boxStartRec = (boxNum - 1) * recordsPerBox + 1;

    var boxEndRec = Math.min(boxNum * recordsPerBox, totalRecs);

     

    FusionPro.Composition.AddVariable("totalRecs", totalRecs);

    FusionPro.Composition.AddVariable("boxNum", boxNum);

    FusionPro.Composition.AddVariable("numBoxes", numBoxes);

    FusionPro.Composition.AddVariable("boxStartRec", boxStartRec);

    FusionPro.Composition.AddVariable("boxEndRec", boxEndRec);

    FusionPro.Composition.AddVariable("boxStartName", data.GetFieldValue(boxStartRec, nameFieldName));

    FusionPro.Composition.AddVariable("boxEndName", data.GetFieldValue(boxEndRec, nameFieldName));

  3. Thank you very much for your solution.

    I did end up with another solution.

    I moved the Header Shading up to the Header Declaration section.

     

     

    //Be sure to check "Treat returned strings as tagged text"//

    //This will create a table filled with record rang dependenat upon (var recordsPerBox)//

    //Creat this as a textRule

    //Include OnJobStart rule "OnjobStart_not all records""

     

    var recordsPerBox = 2500;

    var nameFieldName = "first";

     

    var table = new FPTable;

    var numColumns = 13;

    for (var c = 0; c < numColumns; c++)

    {

    var width = 2500;

    if (c == 0)

    width = 3500;

    if (c == 1)

    width = 3500;

    if (c == 2)

    width = 6500;

    if (c == 3)

    width = 11500;

    if (c == 4)

    width = 11500;

     

    table.AddColumn(width);

    }

     

    var data = new ExternalDataFileEx(PrimaryInputFile());

    var totalRecs = data.recordCount;

    var numBoxes = Math.ceil(totalRecs / recordsPerBox);

     

    for (var boxNum = 0; boxNum <= numBoxes;boxNum++)

    {

    var row = table.AddRow();

     

    if (boxNum == 0)

    {

    //row.type = row.Header;

    //new solution - HEADER DECLARATION

    table.Rows[0].Type = "Header"

    table.Rows[0].Cells[0].ShadeColor = "Black";

    table.Rows[0].Cells[0].ShadePct = 100;

    table.Rows[0].Cells[0].TextColor = "White";

    table.Rows[0].CopyCells (0,1,2,3,4,5,6,7,8,9,10,11,12);

    row.SetContents("Sec#", "Box #", "Records Range", "first rec.", "last rec.");

     

    }

    else

    {

    var boxStartRec = (boxNum - 1) * recordsPerBox + 1;

    var boxEndRec = Math.min(boxNum * recordsPerBox, totalRecs);

    var boxStartName = (data.GetFieldValue(boxStartRec, nameFieldName));

    var boxEndName = (data.GetFieldValue(boxEndRec, nameFieldName));

     

     

    row.Cells[0].Content = "";

    row.Cells[1].Content = boxNum + "/" + numBoxes;

    row.Cells[2].Content = boxStartRec + "-" + boxEndRec;

    row.Cells[3].Content = boxStartName;

    row.Cells[4].Content = boxEndName;

    }

     

    for (var c = 0; c < numColumns; c++)

    {

    var cell = row.Cells[c];

    cell.HAlign = "Center";

    cell.SetBorders("Thin", "Black", "Top", "Bottom", "Left", "Right");

    cell.Margins = { Top:45, Bottom:45, Left:20, Right:20 };

     

    if (boxNum == 0)

    {

    //Moved to Header Declaration

    //cell.TextColor = "White";

    //cell.ShadeColor = "Black";

    //cell.ShadePct = 100;

    }

    }

    }

     

    table.ShadingColor1 = "Black";

    table.ShadingPct1 = 30;

    table.ShadingRepeat1 = 2;

    table.ShadingColor2 = "White";

    table.ShadingRepeat2 = 2;

    table.ShadingType = "ByRow";

     

    return table.MakeTags();

  4. Hello,

     

    I am trying to set my row shading to be every two rows. The problem I am having is that the first row starts shaded then the every two row pattern starts.

    How do I get the shading to be correct?

     

    This is the bit of code I am using to set the Shading Pattern:

     

    for (var c = 0; c < numColumns; c++)

    {

    var cell = row.Cells[c];

    cell.HAlign = "Center";

    cell.SetBorders("Thin", "Black", "Top", "Bottom", "Left", "Right");

    cell.Margins = { Top:45, Bottom:45, Left:20, Right:20 };

     

    if (boxNum == 0)

    {

    cell.TextColor = "White";

    cell.ShadeColor = "Black";

    cell.ShadePct = 100;

    }

    }

    }

     

    table.ShadingColor1 = "Black";

    table.ShadingPct1 = 30;

    table.ShadingRepeat1 = 2;

    table.ShadingColor2 = "White";

    table.ShadingRepeat2 = 2;

    table.ShadingType = "ByRow";

     

    return table.MakeTags();

     

    I have also included a screenshot.

    Thank you for your help.

    VDP WorksheetNEW.pdf

    test data.csv.zip

    worksheet.png.bc233a52bfb9ce429f1a00cb86d5812b.png

  5. As you discovered, since you have the "Re-evaluate this rule for every text flow" box checked in your rule, you can use the properties FusionPro.Composition.currentPageNumber and FusionPro.Composition.totalPages instead. However, those will output per-record page numbers, not per-job page or sheet numbers.

     

    Dan, I think we are getting somewhere now. I wasn't clear in my first post, but I do want a current sheet number and total sheets per record in the barcode for the Inserter to scan. The scanner only scans the front of the sheet.

     

    In this particular instance the total pages per record is constant. The numbers will alternate 0102, 0202. I can manually configure this in the data. I was just trying to automate the function for a possible instance where the total pages per record could vary depending on the data -- perhaps using trigger fields.

     

    (To be clear: I come from commercial printing; a page is either the front or back of a sheet; a sheet is the front and back of a set; a sig or signature is an imposition of sheets)

     

    Thank you for all you do, your time and your patience.

  6. Thank you Dan.

     

    I was trying to create a DataMatrix 2D barcode that included the page number and page count so the mail Inserter would know when a particular set started and ended. I wanted to automate the counter in case there were variable number of pages per set.

  7. Below is the code I am using to generate a 25 character DataMatrix barcode.

     

    // Rule converted from XML Template "DataMatrix Barcode":

    // Choose the following values:

    // Begin XML Template selections //

     

    var jobID = "0103999"; // 7 digit

    var sequence = Field("sequence"); // 6 digit

    var currSheet = FormatNumber( "00", FusionPro.Composition.impositionSheetNumber ); // 2 digit

    var totSheets = FormatNumber( "00", FusionPro.Composition.impositionTotalSheets ); // 2 digit

    var feeder1 = Field("feeder1"); // 1 digit

    var feeder2 = Field("feeder2"); // 1 digit

    var feeder3 = Field("feeder3"); // 1 digit

    var feeder4 = Field("feeder4"); // 1 digit

    var feeder5 = Field("feeder5"); // 1 digit

    var feeder6 = Field("feeder6"); // 1 digit

    var divertBin = Field("divertbin"); // 1 digit

    var sortYN = Field("sort"); // 1 digit

    var EncodingMode = "Text";

    var PreferredFormat = "0";

    var PointSize = StringToNumber("6");

    var NoFontTag = false;

    var Font = "IDAutomationDMatrix"; //

    var ProcessTilde = false;

    // End XML Template selections //

     

    var DataToEncode = (jobID + sequence + currSheet + totSheets + feeder1 + feeder2 + feeder3 + feeder4 + feeder5 + feeder6 + divertBin + sortYN);

    return MakeDataMatrixBarcode(DataToEncode, ProcessTilde,

    EncodingMode, PreferredFormat,

    PointSize, NoFontTag, Font);

     

    Need a unique DataMatrix barcode on front of each sheet of a set.

    (sheet = front+back. NON-IMPOSED) Imposition is done at print device.

    (set = 2 sheets)

     

    The Sheet Counter should generate four digits. (0102, 0202; 0102, 0202; etc...)

    The result I am getting is always 0100 for each record.

     

    I have also tried the CurrentPage counter too.

    I just can't figure out how to get the counter to work properly.

    Please help.

    2D Barcode Sheet counter.pdf

    test data.csv.zip

    test data-Output.pdf

  8. I am trying to rework the math of the rule so that a batch is split in two for boxing purposes with no more than 2,500 per box.

     

     

    Here is the existing rule.

    // I think there needs to be a loop here to determine the current batch quantity

     

    var runBatch = (i !< (cannot be greater than) 5000);

     

    // insert for Loop here to check for i > 5000

    // else if runBatch =< 5000

     

    var recordsPerBox = runBatch / 2;

     

    var nameFieldName = "first";

     

    var data = new ExternalDataFileEx(PrimaryInputFile());

    var totalRecs = data.recordCount;

    var numBoxes = Math.ceil(totalRecs / recordsPerBox);

    FusionPro.Composition.repeatRecordCount = numBoxes;

    var boxNum = FusionPro.Composition.repeatRecordNumber;

    var boxStartRec = (boxNum - 1) * recordsPerBox + 1;

    var boxEndRec = Math.min(boxNum * recordsPerBox, totalRecs);

     

     

     

    FusionPro.Composition.AddVariable("totalRecs", totalRecs);

    FusionPro.Composition.AddVariable("boxNum", boxNum);

    FusionPro.Composition.AddVariable("numBoxes", numBoxes);

    FusionPro.Composition.AddVariable("boxStartRec", boxStartRec);

    FusionPro.Composition.AddVariable("boxEndRec", boxEndRec);

    FusionPro.Composition.AddVariable("boxStartName", data.GetFieldValue(boxStartRec, nameFieldName));

    FusionPro.Composition.AddVariable("boxEndName", data.GetFieldValue(boxEndRec, nameFieldName));

    VDP Label Sheet_new.pdf

    label test file_more than 5000.csv.zip

  9. I have had the same problem. Most notably when I export the FP template from InDesign with bleed. The FP template in Acrobat will display the document by the trim size. I have to set the Media Box and Crop Box to the Bleed size - so my FP Template is the bleed size. This usually solves the problem.

     

    Or export the PDF from InDesign with bleed but no marks so the document is the bleed size, and then import or set-up the FP Template.

  10. When I use the toTitleCase function I would like the letter after / to be capitalized.

     

    The data source contains names with /

    i.e.: MARY/ANN to Mary/ann is what I get now

    i.e.: MARY/ANN to Mary/Ann is the result expected

     

    Also: How do I retain suffix capitalization when the name is one field?

    i.e.: John Doe, III instead of John Doe, Iii

     

    Thank you,

    Jeff

  11. Here is the final JavaScript. I duplicated it for each instance I needed and changed the return value accordingly. Had to add var boxStartName and var boxEndName, Also changed OnRecordStart to OnJobStart. Thank you for your help with this! This will be a valuable time saver. :):):)

     

    // automation of box label entries

    // nameFieldName should be mapped to appropiate field use

    var recordsPerBox = 2500;

    var nameFieldName = "first";

     

    var data = new ExternalDataFileEx(PrimaryInputFile());

    var totalRecs = data.recordCount;

    var numBoxes = Math.ceil(totalRecs / recordsPerBox);

    FusionPro.Composition.repeatRecordCount = numBoxes;

    var boxNum = FusionPro.Composition.repeatRecordNumber;

    var boxStartRec = (boxNum - 1) * recordsPerBox + 1;

    var boxEndRec = Math.min(boxNum * recordsPerBox, totalRecs);

    var boxStartName = (data.GetFieldValue(boxStartRec, nameFieldName));

    var boxEndName = (data.GetFieldValue(boxEndRec, nameFieldName));

     

    FusionPro.Composition.AddVariable("totalRecs", totalRecs);

    FusionPro.Composition.AddVariable("boxNum", boxNum);

    FusionPro.Composition.AddVariable("numBoxes", numBoxes);

    FusionPro.Composition.AddVariable("boxStartRec", boxStartRec);

    FusionPro.Composition.AddVariable("boxEndRec", boxEndRec);

    FusionPro.Composition.AddVariable("boxStartName", data.GetFieldValue(boxStartRec, nameFieldName));

    FusionPro.Composition.AddVariable("boxEndName", data.GetFieldValue(boxEndRec, nameFieldName));

    return boxEndName;

  12. Hi Dan,

    Attached is a .csv and FP template that I would like to create to generate box labels of printed items.

    The box label is to have the first and last record of that template in that box.

    I usually just open the .csv document and copy the info from the appropriate record number.

    i.e.,(Label 1)

    record #1 value of field name "first";

    then record #2500 value of field name "first";

    i.e.,(Label 2)

    record #2501 value of field name "first";

    then record #5000 value of field name "first";

    and so on. A little tedious, but gets the job done.

    I am looking for a way to automate the creation of the box labels.

    I hope this is a bit more clear.

    I understand if this is not possible as it seems pretty difficult to automate.

    Thank you,

    Label Sheets_FP.pdf

×
×
  • Create New...