Jump to content

Suppress Empty Rows in Variable Table

Recommended Posts


I have a table that contains data for anywhere from 1-6 rows that I have successfully set up in Fusion.  However, when the additional rows are empty, I need the document to remove the extra empty rows.  For example, if a record only contains 3 rows of values, I need the additional 3 rows of the table to hide so that the borders/grids from the table do not populate.

Link to comment
Share on other sites

First of all, it's FusionPro, not "Fusion."

I'd have to see how you're making the table now.  Many examples have a call to the AddRows function with a set number of rows.  Instead of doing that, you should iterate whatever data source you're pulling the data from, and call table.AddRow() ONLY if there are values to populate that row.  So it's not so much that you're hiding rows that are empty, it's that you're never creating those empty rows in the first place.

Link to comment
Share on other sites

my apologies, Dan.

The table is using a "Table Style" rule, as well as a "Table From Frame" rule.  The text frame associated with the "Table from Frame" rule contains all six variable fields.  Please see below:

Gift Designation    2023 Amount
«Fund 1»    «Gift amount 1»
«Fund 2»    «Gift Amount 2»
«Fund 3»    «Amount 3»
«Fund 4»    «Amount 4»
«Fund 5»    «Amount 5»
«Fund 6»    «Amount 6»

Edited by Sydney
Link to comment
Share on other sites

Ah, I see, the missing info was that you were using the "Table From Frame" rule.  There are a lot of different ways to make tables.

I would change this up to a simple JavaScript data rule to populate the table, rather than pulling the data from the frame.  The data rule would look something like this (though I don't know 100 percent for sure this is right without your data):

var data = [["Gift Designation", "2023 Amount"]];
for (var i = 1; i <= 6; i++)
    var fund = Field("Fund " + i)
    if (fund)
        data.push([fund, Field("Gift Amount " + i)]);
return data;

Then you can create the "Table - from data rule" rule, referencing the data rule, and insert it into your text frame. 

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.

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