Dynamic Table in Reporting

If the formatting difference you’re looking for is the number of rows/columns in the table, and the names on the columns, this can be done, but it is a big of a slog.

Here’s how I did it:

In my report, I have a table with the most columns I expect I could ever need (7 in my case). That table looks for column names like ‘A’, ‘B’, ‘C’, ‘D’ in the dataset it is pulling from. Some layout features of the cells like hidden and width are bound to custom report data named like ‘COL_x_HIDDEN’ and ‘COL_x_WIDTH’ (where ‘x’ is actually A/B/C/D/etc). There is a top row for the names, which is bound to more report data named like ‘COL_x_NAME’.

With all of this setup, you then need to groom your source dataset to the format the report uses. You have to add/remove columns to get it to the same number your report table supports at most. Even if the extra columns won’t be displayed, they still need to be present in the dataset. You save the original name of each column as report data COL_x_NAME and then adjust the column names in the dataset to A/B/C/D/etc. Finally you can adjust the COL_x_WIDTH/COL_x_VISIBLE for each column as desired. If you set WIDTH=0 and VISIBLE=False, then the column disappears and the report table displays as though it has fewer columns.

Maybe some of this was inferred in the discussion of hiding and visibility up above, but it wasn’t obvious to me that you could make a table with a dynamic number of columns and dynamic headers from that.