If you select a table that has a fixed number of rows and columns and make it optional, the header row is repeated for each data item. To change this table to one in which the number of rows will change according to the data, deselect Repeat Row For Each Data Item for the header row but select Repeat Row For Each Data Item for the body row.
Livecycle repeat table for each data item To make a table optional
If you have not connected to a data source, the table should not appear. If you have bound the cells in a table to a data source and there is data for the bound cells, the table should appear.

To make a table optional