View Single Post
Old February 11th, 2019, 03:20 PM
kjacobson's Avatar
kjacobson kjacobson is offline
Regular Contributor
Join Date: Oct 2008
Location: Alameda, CA
Posts: 54
Default Re: Suppressing empty rows in a Table

Hi LyndaEngelage;

If you want to skip a row, you can use the skip type with a condition to check if there is content.

if (Field("Amount_10")=="") {
    table.Rows[9].Type = "Skip";
} else {
    table.Rows[9].Cells[0].Margins = { Top:0, Bottom:68, Left:0, Right:0 };
    table.Rows[9].Cells[0].HAlign = "Left";
    table.Rows[9].Cells[1].Margins = { Top:0, Bottom:68, Left:0, Right:0 };
    table.Rows[9].Cells[1].HAlign = "Center";
    table.Rows[9].Cells[2].Margins = { Top:0, Bottom:68, Left:0, Right:0 };

I've had formatting issue with skipped rows in the past. I have found that it's better to use loops in tables especially when there are sequential fields like you are using.

new FPTable;
var table = new FPTable;

for (i=1;i<=12;i++) {//Loop through fields
    if (Field("Amount_"+i)!="") {//add a row if the Amount field is not empty
        var tableRow = table.AddRow();  
        tableRow.Cells[0].HAlign = "Left";
        tableRow.Cells[1].HAlign = "Center";
        tableRow.SetContents(Field("Designation_"+i),Field("GC"+i),Field("Amount_"+i)); //Add content to the columns
        for (c=0;c<=2;c++) {//loop through cells to apply margins
            tableRow.Cells[c].Margins = { Top:0, Bottom:68, Left:0, Right:0 };

var totalRow = table.AddRow(); //Add total row
totalRow.Cells[0].HAlign = "Left";
totalRow.Cells[2].HAlign = "Center";
totalRow.SetContents("TOTAL 2018 TAX-DEDUCTIBLE GIVING:","",Field("CAL18_TTL")); //Set total row content
for (c=0;c<=2;c++) {//loop through cells to apply margins & font
    totalRow.Cells[c].Margins = { Top:0, Bottom:68, Left:0, Right:0 };
    totalRow.Cells[c].Font = "Brandon Grotesque Bold";

return table.MakeTags();

Hope this helps
Windows 7 | InDesign CC 2017 | Acrobat DC 2019 | FusionPro 11.0.8 | MarcomCentral User
Reply With Quote